1
0
mirror of https://github.com/chylex/Hardcore-Ender-Expansion-2.git synced 2025-09-15 23:32:08 +02:00

1 Commits

Author SHA1 Message Date
f091eb20b2 [WIP] Update to Minecraft 1.16.4 (not worth it yet) 2020-12-08 02:17:31 +01:00
265 changed files with 1222 additions and 1165 deletions

View File

@@ -1,8 +1,8 @@
ext {
mc_version = "1.15.2"
forge_version = "31.2.45"
mapping_version = "20200626-1.15.1"
kotlin_mod_version = "1.6.1"
mc_version = "1.16.4"
forge_version = "35.1.2"
mapping_version = "20201028-1.16.3"
kotlin_mod_version = "1.6.2"
}
buildscript {

View File

@@ -5,13 +5,13 @@ import net.minecraft.block.Block
import net.minecraft.data.DataGenerator
import net.minecraft.data.LootTableProvider
import net.minecraft.data.loot.BlockLootTables
import net.minecraft.loot.LootParameterSet
import net.minecraft.loot.LootParameterSets
import net.minecraft.loot.LootTable
import net.minecraft.loot.LootTable.Builder
import net.minecraft.loot.ValidationTracker
import net.minecraft.util.IItemProvider
import net.minecraft.util.ResourceLocation
import net.minecraft.world.storage.loot.LootParameterSet
import net.minecraft.world.storage.loot.LootParameterSets
import net.minecraft.world.storage.loot.LootTable
import net.minecraft.world.storage.loot.LootTable.Builder
import net.minecraft.world.storage.loot.ValidationTracker
import java.util.function.BiConsumer
import java.util.function.Consumer
import java.util.function.Supplier

View File

@@ -25,7 +25,6 @@ import chylex.hee.system.Debug
import chylex.hee.system.forge.SubscribeAllEvents
import chylex.hee.system.forge.SubscribeEvent
import net.minecraft.block.Blocks
import net.minecraft.world.dimension.DimensionType
import net.minecraftforge.fml.DistExecutor
import net.minecraftforge.fml.DistExecutor.SafeSupplier
import net.minecraftforge.fml.ModLoadingContext

View File

@@ -4,12 +4,14 @@ import chylex.hee.system.facades.Resource
import chylex.hee.system.migration.supply
import net.minecraft.client.Minecraft
import net.minecraft.resources.IPackFinder
import net.minecraft.resources.IPackNameDecorator
import net.minecraft.resources.IResourcePack
import net.minecraft.resources.ResourcePackInfo
import net.minecraft.resources.ResourcePackInfo.IFactory
import net.minecraft.resources.ResourcePackInfo.Priority
import net.minecraft.resources.ResourcePackType
import net.minecraftforge.fml.packs.ResourcePackLoader
import java.util.function.Consumer
object VanillaResourceOverrides : IPackFinder{
fun register(){
@@ -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 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 {

View File

@@ -4,9 +4,9 @@ import chylex.hee.game.container.ContainerAmuletOfRecovery
import chylex.hee.network.server.PacketServerContainerEvent
import chylex.hee.system.forge.Side
import chylex.hee.system.forge.Sided
import net.minecraft.client.resources.I18n
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.util.text.ITextComponent
import net.minecraft.util.text.TranslationTextComponent
import net.minecraftforge.fml.client.gui.widget.ExtendedButton
@Sided(Side.CLIENT)
@@ -14,8 +14,8 @@ class GuiAmuletOfRecovery(container: ContainerAmuletOfRecovery, inventory: Playe
override fun init(){
super.init()
val moveAllTitle = I18n.format("gui.hee.amulet_of_recovery.move_all")
val moveAllWidth = (font.getStringWidth(moveAllTitle) + 14).coerceAtMost(xSize / 2)
val moveAllTitle = TranslationTextComponent("gui.hee.amulet_of_recovery.move_all")
val moveAllWidth = (font.getStringPropertyWidth(moveAllTitle) + 14).coerceAtMost(xSize / 2)
addButton(ExtendedButton(guiLeft + xSize - moveAllWidth - 7, (height / 2) + 6, moveAllWidth, 11, moveAllTitle){
PacketServerContainerEvent(0).sendToServer()

View File

@@ -6,6 +6,7 @@ import chylex.hee.game.world.totalTime
import chylex.hee.system.facades.Resource
import chylex.hee.system.forge.Side
import chylex.hee.system.forge.Sided
import com.mojang.blaze3d.matrix.MatrixStack
import net.minecraft.client.gui.screen.inventory.BrewingStandScreen
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.inventory.container.BrewingStandContainer
@@ -20,13 +21,13 @@ class GuiBrewingStandCustom(container: BrewingStandContainer, inventory: PlayerI
private var brewStartTime = MC.world!!.totalTime
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
override fun drawGuiContainerBackgroundLayer(matrix: MatrixStack, partialTicks: Float, mouseX: Int, mouseY: Int){
val x = (width - xSize) / 2
val y = (height - ySize) / 2
GL.color(1F, 1F, 1F, 1F)
GL.bindTexture(TEX_BACKGROUND)
blit(x, y, 0, 0, xSize, ySize)
blit(matrix, x, y, 0, 0, xSize, ySize)
val worldTime = MC.world!!.totalTime
val brewTime = container.func_216981_f() // RENAME getBrewTime
@@ -35,13 +36,13 @@ class GuiBrewingStandCustom(container: BrewingStandContainer, inventory: PlayerI
val brewProgress = (28F * (1F - (brewTime / 400F))).toInt()
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]
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{
@@ -49,14 +50,14 @@ class GuiBrewingStandCustom(container: BrewingStandContainer, inventory: PlayerI
}
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){
val slot = container.getSlot(slotIndex)
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)
}
}
}

View File

@@ -7,6 +7,7 @@ import chylex.hee.system.color.IntColor.Companion.RGBA
import chylex.hee.system.facades.Resource
import chylex.hee.system.forge.Side
import chylex.hee.system.forge.Sided
import com.mojang.blaze3d.matrix.MatrixStack
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.util.text.ITextComponent
@@ -23,19 +24,19 @@ class GuiTrinketPouch(container: ContainerTrinketPouch, inventory: PlayerInvento
hiddenSlots = ContainerTrinketPouch.MAX_SLOTS - (container as ContainerBaseCustomInventory<*>).containerInventory.size
}
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY)
override fun drawGuiContainerBackgroundLayer(matrix: MatrixStack, partialTicks: Float, mouseX: Int, mouseY: Int){
super.drawGuiContainerBackgroundLayer(matrix, partialTicks, mouseX, mouseY)
val middleSlot = ContainerTrinketPouch.MAX_SLOTS / 2
repeat(hiddenSlots){
renderSlotCover(middleSlot + ((ContainerTrinketPouch.MAX_SLOTS - it) / 2) * (if (it % 2 == 0) -1 else 1))
renderSlotCover(matrix, middleSlot + ((ContainerTrinketPouch.MAX_SLOTS - it) / 2) * (if (it % 2 == 0) -1 else 1))
}
}
private fun renderSlotCover(index: Int){
private fun renderSlotCover(matrix: MatrixStack, index: Int){
val x = guiLeft + 44 + (index * 18)
val y = guiTop + 18
fill(x, y, x + 16, y + 16, hiddenSlotColor)
fill(matrix, x, y, x + 16, y + 16, hiddenSlotColor)
}
}

View File

@@ -5,6 +5,7 @@ import chylex.hee.system.color.IntColor.Companion.RGB
import chylex.hee.system.facades.Resource
import chylex.hee.system.forge.Side
import chylex.hee.system.forge.Sided
import com.mojang.blaze3d.matrix.MatrixStack
import net.minecraft.client.gui.screen.inventory.ContainerScreen
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.inventory.container.ChestContainer
@@ -23,25 +24,25 @@ abstract class GuiBaseChestContainer<T : ChestContainer>(container: T, inventory
ySize = 114 + (containerRows * 18)
}
override fun render(mouseX: Int, mouseY: Int, partialTicks: Float){
renderBackground()
super.render(mouseX, mouseY, partialTicks)
renderHoveredToolTip(mouseX, mouseY)
override fun render(matrix: MatrixStack, mouseX: Int, mouseY: Int, partialTicks: Float){
renderBackground(matrix)
super.render(matrix, mouseX, mouseY, partialTicks)
renderHoveredTooltip(matrix, mouseX, mouseY)
}
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
override fun drawGuiContainerBackgroundLayer(matrix: MatrixStack, partialTicks: Float, mouseX: Int, mouseY: Int){
val x = (width - xSize) / 2
val y = (height - ySize) / 2
val heightContainer = 17 + (containerRows * 18)
GL.color(1F, 1F, 1F, 1F)
GL.bindTexture(TEX_BACKGROUND)
blit(x, y, 0, 0, xSize, heightContainer)
blit(x, y + heightContainer, 0, 126, xSize, 96)
blit(matrix, x, y, 0, 0, xSize, heightContainer)
blit(matrix, x, y + heightContainer, 0, 126, xSize, 96)
}
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int){
font.drawString(title.formattedText, 8F, 6F, COLOR_TEXT)
font.drawString(playerInventory.displayName.formattedText, 8F, ySize - 94F, COLOR_TEXT)
override fun drawGuiContainerForegroundLayer(matrix: MatrixStack, mouseX: Int, mouseY: Int){
font.drawString(matrix, title.string, 8F, 6F, COLOR_TEXT)
font.drawString(matrix, playerInventory.displayName.string, 8F, ySize - 94F, COLOR_TEXT)
}
}

View File

@@ -4,6 +4,7 @@ import chylex.hee.game.container.base.ContainerBaseCustomInventory
import chylex.hee.system.color.IntColor.Companion.RGB
import chylex.hee.system.forge.Side
import chylex.hee.system.forge.Sided
import com.mojang.blaze3d.matrix.MatrixStack
import net.minecraft.client.gui.screen.inventory.ContainerScreen
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.util.ResourceLocation
@@ -18,23 +19,23 @@ abstract class GuiBaseCustomInventory<T : ContainerBaseCustomInventory<*>>(conta
protected abstract val texBackground: ResourceLocation
protected abstract val titleContainer: String
override fun render(mouseX: Int, mouseY: Int, partialTicks: Float){
renderBackground()
super.render(mouseX, mouseY, partialTicks)
renderHoveredToolTip(mouseX, mouseY)
override fun render(matrix: MatrixStack, mouseX: Int, mouseY: Int, partialTicks: Float){
renderBackground(matrix)
super.render(matrix, mouseX, mouseY, partialTicks)
renderHoveredTooltip(matrix, mouseX, mouseY)
}
override fun drawGuiContainerBackgroundLayer(partialTicks: Float, mouseX: Int, mouseY: Int){
override fun drawGuiContainerBackgroundLayer(matrix: MatrixStack, partialTicks: Float, mouseX: Int, mouseY: Int){
val x = (width - xSize) / 2
val y = (height - ySize) / 2
GL.color(1F, 1F, 1F, 1F)
GL.bindTexture(texBackground)
blit(x, y, 0, 0, xSize, ySize)
blit(matrix, x, y, 0, 0, xSize, ySize)
}
override fun drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int){
font.drawString(title.formattedText, 8F, 6F, COLOR_TEXT)
font.drawString(playerInventory.displayName.formattedText, 8F, ySize - 94F, COLOR_TEXT)
override fun drawGuiContainerForegroundLayer(matrix: MatrixStack, mouseX: Int, mouseY: Int){
font.drawString(matrix, title.string, 8F, 6F, COLOR_TEXT)
font.drawString(matrix, playerInventory.displayName.string, 8F, ySize - 94F, COLOR_TEXT)
}
}

View File

@@ -8,7 +8,7 @@ import com.mojang.blaze3d.vertex.IVertexBuilder
import net.minecraft.client.renderer.RenderType
import net.minecraft.client.renderer.model.Model
import net.minecraft.client.renderer.model.ModelRenderer
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.vector.Vector3d
import kotlin.math.PI
import kotlin.math.abs
import kotlin.math.sin
@@ -40,7 +40,7 @@ object ModelBlockIgneousPlate : Model(RenderType::getEntityCutout){
outerBox.render(matrix, builder, combinedLight, combinedOverlay, red, green, blue, alpha)
}
fun renderInnerBox(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, color: Vec3d, animation: Double){
fun renderInnerBox(matrix: MatrixStack, builder: IVertexBuilder, combinedLight: Int, combinedOverlay: Int, color: Vector3d, animation: Double){
matrix.push()
matrix.translateZ(-abs(sin(-animation)).toFloat() * 0.0925)
innerBox.render(matrix, builder, combinedLight, combinedOverlay, color.x.toFloat(), color.y.toFloat(), color.z.toFloat(), 1F)

View File

@@ -78,7 +78,7 @@ object OverlayRenderer{
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)
}
@@ -90,6 +90,7 @@ object OverlayRenderer{
fun onRenderText(@Suppress("UNUSED_PARAMETER") e: RenderGameOverlayEvent.Text){
fun drawTextOffScreenCenter(x: Int, y: Int, line: Int, text: String, color: IntColor){
val window = MC.window
val matrix = e.matrixStack
with(MC.fontRenderer){
val centerX = x + (window.scaledWidth / 2)
@@ -101,8 +102,8 @@ object OverlayRenderer{
val offsetX = -(textWidth / 2)
val offsetY = -(textHeight / 2)
AbstractGui.fill(centerX + offsetX - BORDER_SIZE, centerY + offsetY - BORDER_SIZE, centerX - offsetX + BORDER_SIZE - 1, centerY - offsetY + BORDER_SIZE - 1, RGBA(0u, 0.6F).i)
drawStringWithShadow(text, (centerX + offsetX).toFloat(), (centerY + offsetY).toFloat(), color.i)
AbstractGui.fill(matrix, centerX + offsetX - BORDER_SIZE, centerY + offsetY - BORDER_SIZE, centerX - offsetX + BORDER_SIZE - 1, centerY - offsetY + BORDER_SIZE - 1, RGBA(0u, 0.6F).i)
drawStringWithShadow(matrix, text, (centerX + offsetX).toFloat(), (centerY + offsetY).toFloat(), color.i)
}
}

View File

@@ -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.SF_ONE
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.posVec
import chylex.hee.game.particle.ParticleVoid
import chylex.hee.game.particle.spawner.ParticleSpawnerCustom
import chylex.hee.game.particle.spawner.properties.IOffset.InBox
import chylex.hee.game.particle.spawner.properties.IShape.Point
import chylex.hee.game.world.WorldProviderEndCustom
import chylex.hee.game.world.territory.TerritoryType
import chylex.hee.game.world.territory.TerritoryVoid
import chylex.hee.system.Debug
@@ -26,6 +26,7 @@ import chylex.hee.system.math.LerpedFloat
import chylex.hee.system.math.floorToInt
import chylex.hee.system.math.scale
import chylex.hee.system.migration.EntityPlayer
import com.mojang.blaze3d.matrix.MatrixStack
import net.minecraft.client.resources.I18n
import net.minecraftforge.client.event.RenderGameOverlayEvent
import net.minecraftforge.common.MinecraftForge
@@ -45,7 +46,7 @@ object TerritoryRenderer{
if (e.phase == Phase.START){
val player = MC.player
if (player != null && player.world.dimension is WorldProviderEndCustom && player.ticksExisted > 0){
if (player != null && player.dimensionKey === HEE.dim && player.ticksExisted > 0){
Void.tick(player)
Title.tick()
@@ -122,7 +123,7 @@ object TerritoryRenderer{
@SubscribeEvent
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){
add("")
add("End Void Factor: ${"%.3f".format(voidFactor.currentValue)}")
@@ -203,8 +204,8 @@ object TerritoryRenderer{
val x = -fontRenderer.getStringWidth(textTitle) * 0.5F
val y = -fontRenderer.FONT_HEIGHT - 2F
drawTitle(x + 0.5F, y + 0.5F, textShadowColor.withAlpha(opacity.pow(1.25F)))
drawTitle(x, y, textMainColor.withAlpha(opacity))
drawTitle(e.matrixStack, x + 0.5F, y + 0.5F, textShadowColor.withAlpha(opacity.pow(1.25F)))
drawTitle(e.matrixStack, x, y, textMainColor.withAlpha(opacity))
GL.popMatrix()
GL.alphaFunc(GL_GREATER, 0.1F)
@@ -212,9 +213,9 @@ object TerritoryRenderer{
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
MC.fontRenderer.drawString(textTitle, x, y, color.i)
MC.fontRenderer.drawString(matrix, textTitle, x, y, color.i)
}
}
}

View File

@@ -23,12 +23,12 @@ import chylex.hee.system.math.toRadians
import com.mojang.blaze3d.matrix.MatrixStack
import com.mojang.blaze3d.vertex.IVertexBuilder
import net.minecraft.client.renderer.IRenderTypeBuffer
import net.minecraft.client.renderer.Matrix4f
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.vector.Matrix4f
import net.minecraft.util.math.vector.Vector3d
import net.minecraft.world.World
import org.lwjgl.opengl.GL11
import java.util.Random
@@ -209,7 +209,7 @@ abstract class RenderTileAbstractPortal<T : TileEntityPortalInner, C : IPortalCo
builder.pos(mat, sizeNB, yB, sizeNB).color().tex(texW, 0F).endVertex()
}
private fun renderLayer(mat: Matrix4f, builder: IVertexBuilder, layer: Int, dist: Int, diff: Vec3d){
private fun renderLayer(mat: Matrix4f, builder: IVertexBuilder, layer: Int, dist: Int, diff: Vector3d){
val layerIndexRev = 16 - layer
val parallaxMp = (1F + abs(diff.y.toFloat() / 32F)).pow(0.12F)

View File

@@ -4,7 +4,7 @@ import chylex.hee.init.ModAtlases
import chylex.hee.system.facades.Resource
import chylex.hee.system.forge.Side
import chylex.hee.system.forge.Sided
import net.minecraft.client.renderer.model.Material
import net.minecraft.client.renderer.model.RenderMaterial
import net.minecraft.client.renderer.tileentity.ChestTileEntityRenderer
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
import net.minecraft.state.properties.ChestType
@@ -18,9 +18,9 @@ class RenderTileDarkChest(dispatcher: TileEntityRendererDispatcher) : ChestTileE
val TEX_DOUBLE_LEFT = Resource.Custom("entity/dark_chest_left")
val TEX_DOUBLE_RIGHT = Resource.Custom("entity/dark_chest_right")
private val MAT_SINGLE = Material(ModAtlases.ATLAS_TILES, TEX_SINGLE)
private val MAT_DOUBLE_LEFT = Material(ModAtlases.ATLAS_TILES, TEX_DOUBLE_LEFT)
private val MAT_DOUBLE_RIGHT = Material(ModAtlases.ATLAS_TILES, TEX_DOUBLE_RIGHT)
private val MAT_SINGLE = RenderMaterial(ModAtlases.ATLAS_TILES, TEX_SINGLE)
private val MAT_DOUBLE_LEFT = RenderMaterial(ModAtlases.ATLAS_TILES, TEX_DOUBLE_LEFT)
private val MAT_DOUBLE_RIGHT = RenderMaterial(ModAtlases.ATLAS_TILES, TEX_DOUBLE_RIGHT)
}
init{

View File

@@ -20,7 +20,7 @@ class RenderTileEndPortal(dispatcher: TileEntityRendererDispatcher) : RenderTile
}
override fun findController(world: World, pos: BlockPos): IPortalController?{
if (world.dimension.type === HEE.dim){
if (world.dimensionKey === HEE.dim){
return AlwaysOnController
}

View File

@@ -14,7 +14,6 @@ import chylex.hee.system.math.floorToInt
import com.mojang.blaze3d.matrix.MatrixStack
import com.mojang.blaze3d.vertex.IVertexBuilder
import net.minecraft.client.renderer.IRenderTypeBuffer
import net.minecraft.client.renderer.Matrix4f
import net.minecraft.client.renderer.WorldRenderer
import net.minecraft.client.renderer.texture.TextureAtlasSprite
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
@@ -22,6 +21,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.inventory.container.PlayerContainer
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.vector.Matrix4f
import net.minecraft.world.World
import net.minecraftforge.client.event.TextureStitchEvent
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD

View File

@@ -29,7 +29,7 @@ import net.minecraft.client.renderer.RenderType
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.vector.Vector3d
import org.lwjgl.opengl.GL11
@Sided(Side.CLIENT)
@@ -53,7 +53,7 @@ class RenderTileIgneousPlate(dispatcher: TileEntityRendererDispatcher) : TileEnt
RGB(235, 23, 23).asVec
)
private fun getInnerBoxColor(combinedHeat: Float): Vec3d{
private fun getInnerBoxColor(combinedHeat: Float): Vector3d{
val index = combinedHeat.floorToInt().coerceIn(0, COLOR_TRANSITIONS.lastIndex - 1)
val progress = combinedHeat.toDouble() - index

View File

@@ -20,6 +20,7 @@ import com.mojang.blaze3d.matrix.MatrixStack
import net.minecraft.client.renderer.Atlases
import net.minecraft.client.renderer.IRenderTypeBuffer
import net.minecraft.client.renderer.model.IBakedModel
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType
import net.minecraft.client.renderer.texture.TextureAtlasSprite
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer
import net.minecraft.client.renderer.tileentity.TileEntityRenderer
@@ -181,7 +182,7 @@ class RenderTileJarODust(dispatcher: TileEntityRendererDispatcher) : TileEntityR
private val layers = DustLayers(TileEntityJarODust.DUST_CAPACITY)
override fun render(stack: ItemStack, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
override fun func_239207_a_(stack: ItemStack, transformType: TransformType, matrix: MatrixStack, buffer: IRenderTypeBuffer, combinedLight: Int, combinedOverlay: Int){
val nbt = stack.heeTagOrNull?.getListOfCompounds(TileEntityJarODust.LAYERS_TAG)
if (nbt != null){

View File

@@ -4,7 +4,7 @@ import chylex.hee.init.ModAtlases
import chylex.hee.system.facades.Resource
import chylex.hee.system.forge.Side
import chylex.hee.system.forge.Sided
import net.minecraft.client.renderer.model.Material
import net.minecraft.client.renderer.model.RenderMaterial
import net.minecraft.client.renderer.tileentity.ChestTileEntityRenderer
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
import net.minecraft.state.properties.ChestType
@@ -13,14 +13,14 @@ import net.minecraft.state.properties.ChestType
class RenderTileLootChest(dispatcher: TileEntityRendererDispatcher) : ChestTileEntityRenderer<TileEntityLootChest>(dispatcher){
companion object{
val TEX = Resource.Custom("entity/loot_chest")
private val MAT = Material(ModAtlases.ATLAS_TILES, TEX)
private val MAT = RenderMaterial(ModAtlases.ATLAS_TILES, TEX)
}
init{
isChristmas = false
}
override fun getMaterial(tile: TileEntityLootChest, type: ChestType): Material{
override fun getMaterial(tile: TileEntityLootChest, type: ChestType): RenderMaterial{
return MAT
}
}

View File

@@ -57,7 +57,7 @@ class RenderTileTable(dispatcher: TileEntityRendererDispatcher) : TileEntityRend
val itemModel = ForgeHooksClient.handleCameraTransforms(matrix, ModelHelper.getItemModel(itemStack), GUI, false)
val mat = matrix.last
val builder = ItemRenderer.getBuffer(buffer, RenderTypeLookup.getRenderType(itemStack), true /* isItem */, false /* hasGlint */)
val builder = ItemRenderer.getBuffer(buffer, RenderTypeLookup.func_239219_a_(itemStack, true), true /* isItem */, false /* hasGlint */)
for(quad in itemModel.getQuads()){
builder.addVertexData(mat, quad, COLOR_SHADE, COLOR_SHADE, COLOR_SHADE, COLOR_ALPHA, LIGHT, OverlayTexture.NO_OVERLAY)

View File

@@ -23,7 +23,6 @@ import chylex.hee.system.random.nextFloat
import com.mojang.blaze3d.matrix.MatrixStack
import net.minecraft.client.renderer.IRenderTypeBuffer
import net.minecraft.client.renderer.ItemRenderer
import net.minecraft.client.renderer.Matrix4f
import net.minecraft.client.renderer.model.IBakedModel
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
import net.minecraft.client.renderer.texture.OverlayTexture
@@ -32,6 +31,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraft.util.math.vector.Matrix4f
import org.lwjgl.opengl.GL11
import java.util.Collections
import java.util.Random

View File

@@ -115,10 +115,10 @@ open class RenderEntityMobAbstractEnderman(manager: EntityRendererManager) : End
return if (entity.hurtTime == 0 && entity.isAggro) 2 else 0
}
override fun func_230042_a_(entity: EntityEnderman, isVisible: Boolean, isTranslucent: Boolean): RenderType?{
override fun func_230496_a_(entity: EntityEnderman, isVisible: Boolean, isTranslucent: Boolean, isGlowing: Boolean): RenderType?{
return if (isRenderingClone)
RENDER_TYPE_CLONE(getEntityTexture(entity))
else
super.func_230042_a_(entity, isVisible, isTranslucent)
super.func_230496_a_(entity, isVisible, isTranslucent, isGlowing)
}
}

View File

@@ -28,6 +28,7 @@ import net.minecraft.client.renderer.RenderType
import net.minecraft.client.renderer.entity.EntityRendererManager
import net.minecraft.client.renderer.entity.MobRenderer
import net.minecraft.client.renderer.model.IBakedModel
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType.GROUND
import net.minecraft.client.renderer.texture.OverlayTexture
import net.minecraft.item.ItemStack
@@ -66,7 +67,7 @@ class RenderEntityMobBlobby(manager: EntityRendererManager) : MobRenderer<Entity
super.render(entity, yaw, partialTicks, matrix, buffer, combinedLight)
}
override fun func_230042_a_(entity: EntityMobBlobby, isVisible: Boolean, isTranslucent: Boolean): RenderType{
override fun func_230496_a_(entity: EntityMobBlobby, isVisible: Boolean, isTranslucent: Boolean, isGlowing: Boolean): RenderType{
return renderType
}
@@ -111,8 +112,8 @@ class RenderEntityMobBlobby(manager: EntityRendererManager) : MobRenderer<Entity
else -> null // POLISH implement more special cases
}
if (overrideType != null){
stack.item.itemStackTileEntityRenderer.render(stack, matrix, { buffer.getBuffer(overrideType) }, combinedLight, OverlayTexture.NO_OVERLAY)
if (overrideType != null){ // UPDATE test transform
stack.item.itemStackTileEntityRenderer.func_239207_a_(stack, TransformType.NONE, matrix, { buffer.getBuffer(overrideType) }, combinedLight, OverlayTexture.NO_OVERLAY)
}
else if (stack !== fallbackStack){
matrix.pop()

View File

@@ -1,7 +1,7 @@
package chylex.hee.client.render.entity
import chylex.hee.system.forge.Side
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.EntityRendererManager
import net.minecraft.entity.Entity
@@ -9,6 +9,6 @@ import net.minecraft.util.ResourceLocation
@Sided(Side.CLIENT)
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
}

View File

@@ -5,12 +5,12 @@ import chylex.hee.system.forge.Sided
import com.mojang.blaze3d.matrix.MatrixStack
import com.mojang.blaze3d.vertex.IVertexBuilder
import net.minecraft.client.renderer.IRenderTypeBuffer
import net.minecraft.client.renderer.Matrix4f
import net.minecraft.client.renderer.RenderType
import net.minecraft.client.renderer.entity.EntityRenderer
import net.minecraft.client.renderer.entity.EntityRendererManager
import net.minecraft.inventory.container.PlayerContainer
import net.minecraft.util.ResourceLocation
import net.minecraft.util.math.vector.Matrix4f
import java.util.Random
@Sided(Side.CLIENT)

View File

@@ -3,6 +3,7 @@ import chylex.hee.system.forge.Side
import chylex.hee.system.forge.Sided
import com.mojang.blaze3d.matrix.MatrixStack
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.TileEntityRendererDispatcher
import net.minecraft.item.ItemStack
@@ -10,7 +11,7 @@ import net.minecraft.tileentity.TileEntity
@Sided(Side.CLIENT)
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)
}
}

View File

@@ -12,7 +12,7 @@ import net.minecraft.client.renderer.RenderHelper
import net.minecraft.client.renderer.Tessellator
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
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 org.lwjgl.opengl.GL11.GL_QUADS
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) }
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
fun renderPlane(matrix: MatrixStack, y: Float, size: Float, rescale: Float){

View File

@@ -1,10 +1,10 @@
package chylex.hee.client.render.territory.components
import net.minecraft.util.ResourceLocation
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.vector.Vector3d
class SkyCubeStatic(
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 rescale: Float = DEFAULT_RESCALE,
override val distance: Float = DEFAULT_DISTANCE

View File

@@ -1,15 +1,15 @@
package chylex.hee.client.render.territory.components
import net.minecraft.util.ResourceLocation
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.vector.Vector3d
class SkyDomeStatic(
override val texture: ResourceLocation = DEFAULT_TEXTURE,
override val color1: Vec3d = DEFAULT_COLOR,
override val color2: Vec3d = DEFAULT_COLOR,
override val color1: Vector3d = DEFAULT_COLOR,
override val color2: Vector3d = DEFAULT_COLOR,
override val alpha1: Float = DEFAULT_ALPHA,
override val alpha2: Float = DEFAULT_ALPHA
) : 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, color1: Vec3d, color2: Vec3d, 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, alpha: Float = DEFAULT_ALPHA) : this(texture, color, color, 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: Vector3d = DEFAULT_COLOR, alpha1: Float, alpha2: Float) : this(texture, color, color, alpha1, alpha2)
}

View File

@@ -11,12 +11,12 @@ import chylex.hee.system.forge.Sided
import com.mojang.blaze3d.matrix.MatrixStack
import net.minecraft.client.world.ClientWorld
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
class SkyPlaneTopFoggy(
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 rescale: Float = DEFAULT_RESCALE,
override val distance: Float = DEFAULT_DISTANCE,

View File

@@ -1,10 +1,10 @@
package chylex.hee.client.render.territory.components
import net.minecraft.util.ResourceLocation
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.vector.Vector3d
class SunStatic(
override val texture: ResourceLocation,
override val color: Vec3d = DEFAULT_COLOR,
override val color: Vector3d = DEFAULT_COLOR,
override val alpha: Float = DEFAULT_ALPHA,
override val size: Float,
override val distance: Float = DEFAULT_DISTANCE

View File

@@ -15,12 +15,12 @@ class MovingSoundSpatialDash(private val entity: EntityProjectileSpatialDash) :
override fun tick(){
if (!entity.isAlive){
donePlaying = true
finishPlaying()
return
}
x = entity.posX.toFloat()
y = entity.posY.toFloat()
z = entity.posZ.toFloat()
x = entity.posX
y = entity.posY
z = entity.posZ
}
}

View File

@@ -42,7 +42,7 @@ object CommandDebugTerritory : ICommand{
val instance = TerritoryInstance.fromPos(pos)
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)
return 0
}

View File

@@ -13,6 +13,7 @@ import com.mojang.brigadier.context.CommandContext
import net.minecraft.command.CommandException
import net.minecraft.command.CommandSource
import net.minecraft.command.Commands.argument
import net.minecraft.util.text.IFormattableTextComponent
import net.minecraft.util.text.ITextComponent
import net.minecraft.util.text.StringTextComponent
import net.minecraft.util.text.TextFormatting.DARK_GREEN
@@ -85,7 +86,7 @@ object CommandServerHelp : ICommand, CommandExecutionFunctionCtx<Boolean>{
send(source, emptyLine)
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)
@@ -100,7 +101,7 @@ object CommandServerHelp : ICommand, CommandExecutionFunctionCtx<Boolean>{
send(source, chainTextComponents(
StringTextComponent(" "),
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?){
val components = mutableListOf<ITextComponent>()
val components = mutableListOf<IFormattableTextComponent>()
if (totalPages == null){
components.add(TranslationTextComponent("commands.hee.help.footer.admin").also {
@@ -151,15 +152,15 @@ object CommandServerHelp : ICommand, CommandExecutionFunctionCtx<Boolean>{
if (page != null){
style.clickEvent = ClickEvent(RUN_COMMAND, "/${ModCommands.ROOT} help $page")
style.color = GREEN
style.underlined = true
style.setFormatting(GREEN)
style.setUnderlined(true)
}
else{
style.color = DARK_GREEN
style.setFormatting(DARK_GREEN)
}
}
private fun chainTextComponents(vararg components: ITextComponent): ITextComponent{
return components.reduce(ITextComponent::appendSibling)
private fun chainTextComponents(vararg components: IFormattableTextComponent): ITextComponent{
return components.reduce(IFormattableTextComponent::append)
}
}

View File

@@ -15,7 +15,7 @@ import net.minecraft.command.Commands.literal
import net.minecraft.command.arguments.BlockPosArgument.blockPos
import net.minecraft.command.arguments.ResourceLocationArgument.getResourceLocation
import net.minecraft.command.arguments.ResourceLocationArgument.resourceLocation
import net.minecraft.world.storage.loot.LootTable
import net.minecraft.loot.LootTable
object CommandServerLootChest : ICommand{
override val name = "lootchest"

View File

@@ -16,11 +16,9 @@ import chylex.hee.system.serialization.getLongOrNull
import chylex.hee.system.serialization.getOrCreateCompound
import net.minecraft.block.BlockState
import net.minecraft.block.material.Material
import net.minecraft.block.material.MaterialColor
import net.minecraft.entity.Entity
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec3d
import net.minecraft.world.IBlockReader
import net.minecraft.util.math.vector.Vector3d
import net.minecraft.world.IWorldReader
import net.minecraft.world.World
@@ -98,12 +96,8 @@ abstract class BlockAbstractGoo(
abstract fun onInsideGoo(entity: Entity)
abstract fun modifyMotion(entity: Entity, level: Int)
override fun getMaterialColor(state: BlockState, world: IBlockReader, pos: BlockPos): MaterialColor{
return fluid.mapColor
}
@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
}
}

View File

@@ -14,7 +14,7 @@ import chylex.hee.system.migration.ItemSword
import net.minecraft.block.BlockState
import net.minecraft.entity.Entity
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.VoxelShape
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){
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){
val canBreak = when(entity){

View File

@@ -40,7 +40,6 @@ import net.minecraft.entity.Entity
import net.minecraft.state.StateContainer.Builder
import net.minecraft.util.math.BlockPos
import net.minecraft.world.IBlockReader
import net.minecraft.world.IWorldReader
import net.minecraft.world.World
import net.minecraft.world.server.ServerWorld
import java.util.Random
@@ -123,10 +122,6 @@ class BlockCorruptedEnergy(builder: BlockBuilder) : BlockSimple(builder){
// 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){
world.pendingBlockTicks.scheduleTick(pos, this, tickRateForLevel(state[LEVEL]))
}

View File

@@ -9,14 +9,13 @@ import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.item.BlockItemUseContext
import net.minecraft.item.ItemStack
import net.minecraft.loot.LootContext
import net.minecraft.state.StateContainer.Builder
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.RayTraceResult
import net.minecraft.world.IBlockReader
import net.minecraft.world.IWorldReader
import net.minecraft.world.World
import net.minecraft.world.server.ServerWorld
import net.minecraft.world.storage.loot.LootContext
import java.util.Random
class BlockDeathFlowerDecaying(builder: BlockBuilder) : BlockEndPlant(builder), IBlockDeathFlowerDecaying, IBlockLayerCutout{
@@ -33,10 +32,6 @@ class BlockDeathFlowerDecaying(builder: BlockBuilder) : BlockEndPlant(builder),
override val witheredFlowerBlock
get() = ModBlocks.DEATH_FLOWER_WITHERED
override fun tickRate(world: IWorldReader): Int{
return implTickRate()
}
override fun getStateForPlacement(context: BlockItemUseContext): BlockState{
return defaultState.with(LEVEL, ItemDeathFlower.getDeathLevel(context.item))
}

View File

@@ -32,7 +32,7 @@ import net.minecraft.util.Hand
import net.minecraft.util.SoundCategory
import net.minecraft.util.math.BlockPos
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.World
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){
EntityItem(world, pos.x + 0.5, pos.y.toDouble(), pos.z + 0.5, ItemStack(this)).apply {
motion = Vec3d.ZERO
motion = Vector3d.ZERO
setDefaultPickupDelay()
world.addEntity(this)
}

View File

@@ -12,7 +12,7 @@ import net.minecraft.block.BlockState
import net.minecraft.client.renderer.color.IBlockColor
import net.minecraft.util.math.BlockPos
import net.minecraft.world.FoliageColors
import net.minecraft.world.ILightReader
import net.minecraft.world.IBlockDisplayReader
import net.minecraft.world.IWorldReader
import net.minecraft.world.biome.BiomeColors
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 isLadder(state: BlockState, world: IWorldReader, pos: BlockPos, entity: EntityLivingBase): Boolean{
return !entity.onGround
return !entity.isOnGround
}
// Client side
@@ -44,7 +44,7 @@ class BlockDryVines(builder: BlockBuilder) : BlockVine(builder.p), IBlockLayerCu
).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
if (world == null || pos == null){

View File

@@ -17,7 +17,6 @@ import net.minecraft.tileentity.TileEntity
import net.minecraft.util.math.BlockPos
import net.minecraft.world.IBlockReader
import net.minecraft.world.World
import net.minecraft.world.dimension.DimensionType
class BlockEndPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder){
override fun createTileEntity(state: BlockState, world: IBlockReader): TileEntity{
@@ -29,8 +28,8 @@ class BlockEndPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder){
return
}
if (world.dimension.type === HEE.dim){
DimensionTeleporter.changeDimension(entity, DimensionType.OVERWORLD, DimensionTeleporter.LastEndPortal)
if (world.dimensionKey === HEE.dim){
DimensionTeleporter.changeDimension(entity, World.OVERWORLD, DimensionTeleporter.LastEndPortal)
}
else{
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)
}
DimensionTeleporter.changeDimension(entity, DimensionType.THE_END, DimensionTeleporter.EndSpawnPortal)
DimensionTeleporter.changeDimension(entity, World.THE_END, DimensionTeleporter.EndSpawnPortal)
}
}
}

View File

@@ -26,7 +26,6 @@ import chylex.hee.system.migration.Potions
import net.minecraft.block.BlockState
import net.minecraft.entity.Entity
import net.minecraft.util.math.BlockPos
import net.minecraft.world.IWorldReader
import net.minecraft.world.World
import java.util.Random
import kotlin.math.pow
@@ -110,10 +109,6 @@ open class BlockEnderGoo : BlockAbstractGoo(FluidEnderGoo, Materials.ENDER_GOO){
// Behavior
override fun tickRate(world: IWorldReader): Int{
return 18
}
override fun onInsideGoo(entity: Entity){
if (entity is EntityLivingBase && !CustomCreatureType.isEnder(entity)){
updateGooEffects(entity, trackTick(entity, MAX_COLLISION_TICK_COUNTER))

View File

@@ -29,7 +29,6 @@ import net.minecraft.block.BlockState
import net.minecraft.entity.Entity
import net.minecraft.potion.EffectType.HARMFUL
import net.minecraft.util.math.BlockPos
import net.minecraft.world.IWorldReader
import net.minecraft.world.World
import java.util.Random
import kotlin.math.max
@@ -121,10 +120,6 @@ open class BlockEnderGooPurified : BlockAbstractGoo(FluidEnderGooPurified, Mater
// Behavior
override fun tickRate(world: IWorldReader): Int{
return 16
}
override fun onInsideGoo(entity: Entity){
if (entity is EntityLivingBase){
updateGooEffects(entity, trackTick(entity, MAX_COLLISION_TICK_COUNTER))

View File

@@ -19,7 +19,7 @@ import net.minecraft.block.BlockRenderType.INVISIBLE
import net.minecraft.block.BlockState
import net.minecraft.client.particle.ParticleManager
import net.minecraft.entity.Entity
import net.minecraft.entity.IProjectile
import net.minecraft.entity.projectile.ProjectileEntity
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
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){
if (entity is IProjectile){
if (entity is ProjectileEntity){
pos.removeBlock(world)
}
}

View File

@@ -33,9 +33,8 @@ import net.minecraft.particles.ParticleTypes.LARGE_SMOKE
import net.minecraft.util.Direction
import net.minecraft.util.SoundCategory
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.IWorldReader
import net.minecraft.world.World
import net.minecraft.world.server.ServerWorld
import net.minecraftforge.common.MinecraftForge
@@ -53,7 +52,6 @@ class BlockEternalFire(builder: BlockBuilder) : BlockFire(builder.p), IBlockLaye
MinecraftForge.EVENT_BUS.register(this)
}
override fun tickRate(world: IWorldReader) = super.tickRate(world) * 2
override fun canDie(world: World, pos: BlockPos) = false
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)
}
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))
250
@@ -143,7 +141,7 @@ class BlockEternalFire(builder: BlockBuilder) : BlockFire(builder.p), IBlockLaye
if (rand.nextInt(3) != 0){
if (pos.down().isTopSolid(world)){
PARTICLE_SMOKE.spawn(Point(Vec3d(
PARTICLE_SMOKE.spawn(Point(Vector3d(
pos.x + rand.nextFloat(0.0, 1.0),
pos.y + rand.nextFloat(0.5, 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 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.y + rand.nextFloat(0.0, 1.0),
pos.z + 0.5 + (facing.zOffset * offsetFacing) + (perpendicular.zOffset * offsetSide)

View File

@@ -13,6 +13,7 @@ import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.block.Blocks
import net.minecraft.item.ItemStack
import net.minecraft.loot.LootContext
import net.minecraft.state.StateContainer.Builder
import net.minecraft.util.ActionResultType
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.RayTraceResult
import net.minecraft.world.IBlockReader
import net.minecraft.world.IWorldReader
import net.minecraft.world.World
import net.minecraft.world.server.ServerWorld
import net.minecraft.world.storage.loot.LootContext
import java.util.Random
class BlockFlowerPotDeathFlowerDecaying(
@@ -45,12 +44,8 @@ class BlockFlowerPotDeathFlowerDecaying(
override val witheredFlowerBlock
get() = ModBlocks.POTTED_DEATH_FLOWER_WITHERED
override fun tickRate(world: IWorldReader): Int{
return implTickRate()
}
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>{

View File

@@ -25,6 +25,9 @@ import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.item.BlockItemUseContext
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.tileentity.TileEntity
import net.minecraft.util.DamageSource
@@ -40,9 +43,6 @@ import net.minecraft.world.IBlockReader
import net.minecraft.world.IWorld
import net.minecraft.world.World
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
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){
LootContext.Builder(world)
.withRandom(world.rand)
.withParameter(LootParameters.POSITION, pos)
.withParameter(LootParameters.field_237457_g_, pos)
.withParameter(LootParameters.EXPLOSION_RADIUS, explosion.size)
.withParameter(LootParameters.TOOL, ItemStack.EMPTY)
.withNullableParameter(LootParameters.BLOCK_ENTITY, null)

View File

@@ -1,7 +1,7 @@
package chylex.hee.game.block
import chylex.hee.game.block.properties.BlockBuilder
import chylex.hee.game.inventory.size
import chylex.hee.game.world.breakBlock
import chylex.hee.game.world.center
import chylex.hee.game.world.getBlock
import chylex.hee.game.world.getState
import chylex.hee.system.forge.SubscribeEvent
@@ -15,14 +15,14 @@ import net.minecraft.block.Blocks
import net.minecraft.entity.Entity
import net.minecraft.item.ItemStack
import net.minecraft.item.Items
import net.minecraft.loot.LootContext
import net.minecraft.loot.LootParameters
import net.minecraft.util.Direction
import net.minecraft.util.math.BlockPos
import net.minecraft.world.Explosion
import net.minecraft.world.IBlockReader
import net.minecraft.world.World
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.IPlantable
import net.minecraftforge.common.MinecraftForge
@@ -101,7 +101,7 @@ class BlockHumus(builder: BlockBuilder, mergeBottom: Block) : BlockSimpleMerging
if (world is ServerWorld){
LootContext.Builder(world)
.withRandom(world.rand)
.withParameter(LootParameters.POSITION, pos)
.withParameter(LootParameters.field_237457_g_, pos.center)
.withParameter(LootParameters.EXPLOSION_RADIUS, explosion.size)
.withParameter(LootParameters.TOOL, ItemStack.EMPTY)
.withNullableParameter(LootParameters.BLOCK_ENTITY, null)

View File

@@ -17,7 +17,7 @@ import chylex.hee.system.migration.ItemTool
import net.minecraft.block.BlockState
import net.minecraft.enchantment.EnchantmentHelper
import net.minecraft.enchantment.Enchantments
import net.minecraft.fluid.IFluidState
import net.minecraft.fluid.FluidState
import net.minecraft.item.ItemStack
import net.minecraft.particles.ParticleTypes.LAVA
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)
if ((getToolHarvestLevel(heldItem) ?: 0) < super.getHarvestLevel(state) || EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, player.getHeldItem(MAIN_HAND)) == 0){

View File

@@ -18,8 +18,10 @@ import chylex.hee.system.migration.Sounds
import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.block.Blocks
import net.minecraft.fluid.IFluidState
import net.minecraft.fluid.FluidState
import net.minecraft.item.ItemStack
import net.minecraft.loot.LootContext
import net.minecraft.loot.LootParameters
import net.minecraft.state.StateContainer.Builder
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.Direction
@@ -31,8 +33,6 @@ import net.minecraft.world.Explosion
import net.minecraft.world.IBlockReader
import net.minecraft.world.World
import net.minecraft.world.server.ServerWorld
import net.minecraft.world.storage.loot.LootContext
import net.minecraft.world.storage.loot.LootParameters
import java.util.Random
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)
}
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){
catchFire(state, world, pos, null, player)
pos.removeBlock(world)

View File

@@ -25,6 +25,8 @@ import net.minecraft.block.BlockState
import net.minecraft.block.Blocks
import net.minecraft.client.util.ITooltipFlag
import net.minecraft.item.ItemStack
import net.minecraft.loot.LootContext
import net.minecraft.loot.LootParameters
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.ActionResultType
import net.minecraft.util.ActionResultType.PASS
@@ -43,8 +45,6 @@ import net.minecraft.world.IBlockReader
import net.minecraft.world.IWorld
import net.minecraft.world.IWorldReader
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{
companion object{

View File

@@ -48,7 +48,7 @@ import net.minecraft.util.Direction
import net.minecraft.util.IStringSerializable
import net.minecraft.util.SoundCategory
import net.minecraft.util.math.BlockPos
import net.minecraft.world.ILightReader
import net.minecraft.world.IBlockDisplayReader
import net.minecraft.world.World
import java.util.Random
@@ -185,7 +185,7 @@ sealed class BlockPuzzleLogic(builder: BlockBuilder) : BlockSimple(builder), IBl
DISABLED -> DISABLED
}
override fun getName(): String{
override fun getString(): String{
return serializableName
}
}
@@ -284,7 +284,7 @@ sealed class BlockPuzzleLogic(builder: BlockBuilder) : BlockSimple(builder), IBl
@Sided(Side.CLIENT)
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){
return NO_TINT
}

View File

@@ -13,6 +13,8 @@ import net.minecraft.block.BlockState
import net.minecraft.inventory.container.INamedContainerProvider
import net.minecraft.item.DyeColor
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.TileEntity
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.world.IBlockReader
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
class BlockShulkerBoxOverride(properties: Properties, color: DyeColor?) : BlockShulkerBox(color, properties){

View File

@@ -29,8 +29,8 @@ import net.minecraft.util.math.BlockRayTraceResult
import net.minecraft.util.math.shapes.ISelectionContext
import net.minecraft.util.math.shapes.VoxelShape
import net.minecraft.util.math.shapes.VoxelShapes
import net.minecraft.world.IBlockDisplayReader
import net.minecraft.world.IBlockReader
import net.minecraft.world.ILightReader
import net.minecraft.world.IWorld
import net.minecraft.world.World
import java.util.UUID
@@ -210,7 +210,7 @@ class BlockTablePedestal(builder: BlockBuilder) : BlockSimpleShaped(builder, COM
@Sided(Side.CLIENT)
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){
return NO_TINT
}

View File

@@ -8,6 +8,7 @@ import chylex.hee.game.block.properties.BlockBuilder
import chylex.hee.game.block.properties.Property
import chylex.hee.game.entity.Teleporter
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.portal.DimensionTeleporter
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.util.IStringSerializable
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.World
import net.minecraft.world.dimension.DimensionType
class BlockVoidPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder){
companion object{
@@ -61,7 +61,7 @@ class BlockVoidPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder)
}
else{
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_INACTIVE("return_inactive");
override fun getName(): String{
override fun getString(): String{
return serializableName
}
}
@@ -145,14 +145,14 @@ class BlockVoidPortalInner(builder: BlockBuilder) : BlockAbstractPortal(builder)
val info = pos.closestTickingTile<TileEntityVoidPortalStorage>(world, MAX_DISTANCE_FROM_FRAME)?.prepareSpawnPoint(entity)
if (info != null){
if (entity.dimension === HEE.dim){
if (entity.dimensionKey === HEE.dim){
DimensionTeleporter.LastHubPortal.updateForEntity(entity, null)
updateSpawnPortal(entity, pos)
teleportEntity(entity, info)
}
else{
DimensionTeleporter.LastHubPortal.updateForEntity(entity, pos)
DimensionTeleporter.changeDimension(entity, DimensionType.THE_END, DimensionTeleporter.EndTerritoryPortal(info))
DimensionTeleporter.changeDimension(entity, World.THE_END, DimensionTeleporter.EndTerritoryPortal(info))
}
}
}

View File

@@ -1,5 +1,5 @@
package chylex.hee.game.block
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)

View File

@@ -75,15 +75,9 @@ interface IBlockDeathFlowerDecaying{
PacketClientFX(FX_HEAL, FxHealData(pos, newDecayLevel)).sendToAllAround(world, pos, 64.0)
}
@JvmDefault
fun implTickRate(): Int{
return 1600
}
@JvmDefault
fun implOnBlockAdded(world: World, pos: BlockPos){
val tickRate = implTickRate()
world.pendingBlockTicks.scheduleTick(pos, thisAsBlock, world.rand.nextInt(tickRate / 4, tickRate))
world.pendingBlockTicks.scheduleTick(pos, thisAsBlock, world.rand.nextInt(TICK_RATE / 4, TICK_RATE))
}
@JvmDefault
@@ -92,7 +86,7 @@ interface IBlockDeathFlowerDecaying{
return
}
world.pendingBlockTicks.scheduleTick(pos, thisAsBlock, implTickRate())
world.pendingBlockTicks.scheduleTick(pos, thisAsBlock, TICK_RATE)
if (world.isPeaceful){
return
@@ -170,6 +164,7 @@ interface IBlockDeathFlowerDecaying{
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_PLAYER_RADIUS = 1024.0

View File

@@ -6,7 +6,7 @@ import net.minecraft.item.ItemStack
object DispenseEndermanHead : OptionalDispenseBehavior(){
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
}
}

View File

@@ -2,12 +2,12 @@ package chylex.hee.game.block.dispenser
import chylex.hee.game.entity.projectile.EntityProjectileExperienceBottle
import net.minecraft.dispenser.IPosition
import net.minecraft.dispenser.ProjectileDispenseBehavior
import net.minecraft.entity.IProjectile
import net.minecraft.entity.projectile.ProjectileEntity
import net.minecraft.item.ItemStack
import net.minecraft.world.World
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)
}

View File

@@ -51,7 +51,7 @@ import net.minecraft.tileentity.ITickableTileEntity
import net.minecraft.tileentity.TileEntityType
import net.minecraft.util.SoundCategory
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.WeakHashMap
import kotlin.math.min
@@ -189,7 +189,7 @@ class TileEntityExperienceGate(type: TileEntityType<TileEntityExperienceGate>) :
val newCharge = tokenHolder.currentCharge + (1F / 175F)
if (newCharge >= 1F){
tokenHolder.forceDropToken(Vec3d.ZERO)
tokenHolder.forceDropToken(Vector3d.ZERO)
tokenHolder.currentCharge = 0F
experience = 0F
}

View File

@@ -29,7 +29,7 @@ import chylex.hee.system.serialization.use
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntityType
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.max
import kotlin.math.min
@@ -105,7 +105,7 @@ class TileEntityIgneousPlate(type: TileEntityType<TileEntityIgneousPlate>) : Til
val rand = wrld.rand
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)
}

View File

@@ -5,6 +5,7 @@ import chylex.hee.game.block.entity.base.TileEntityBaseChest
import chylex.hee.game.container.ContainerLootChest
import chylex.hee.game.inventory.nonEmptySlots
import chylex.hee.game.inventory.setStack
import chylex.hee.game.world.center
import chylex.hee.game.world.playServer
import chylex.hee.init.ModSounds
import chylex.hee.init.ModTileEntities
@@ -20,6 +21,9 @@ import net.minecraft.entity.player.PlayerInventory
import net.minecraft.inventory.IInventory
import net.minecraft.inventory.Inventory
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.util.ResourceLocation
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.TranslationTextComponent
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
class TileEntityLootChest(type: TileEntityType<TileEntityLootChest>) : TileEntityBaseChest(type){
@@ -109,7 +110,7 @@ class TileEntityLootChest(type: TileEntityType<TileEntityLootChest>) : TileEntit
val world = wrld as ServerWorld
val lootContext = LootContext.Builder(world)
.withRandom(world.rand)
.withParameter(LootParameters.POSITION, pos)
.withParameter(LootParameters.field_237457_g_, pos.center)
.withParameter(LootParameters.THIS_ENTITY, player)
.withLuck(player.luck)
.build(LootParameterSets.CHEST)

View File

@@ -53,7 +53,7 @@ import net.minecraft.tileentity.ITickableTileEntity
import net.minecraft.tileentity.TileEntityType
import net.minecraft.util.SoundCategory
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 java.util.Random
import kotlin.math.max
@@ -110,7 +110,7 @@ class TileEntityMinersBurialAltar(type: TileEntityType<TileEntityMinersBurialAlt
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 {
writeCompactVec(pos)
writeByte(type.toInt())
@@ -231,7 +231,7 @@ class TileEntityMinersBurialAltar(type: TileEntityType<TileEntityMinersBurialAlt
if (tick == 0){
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)
EntityTokenHolder(wrld, tokenHolderPos, TokenType.NORMAL, TerritoryType.CURSED_LIBRARY).apply {

View File

@@ -145,7 +145,7 @@ abstract class TileEntityBaseChest(type: TileEntityType<out TileEntityBaseChest>
}
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){
viewerCount = getShort(VIEWER_COUNT_TAG).toInt()

View File

@@ -28,10 +28,10 @@ import chylex.hee.system.serialization.getPosOrNull
import chylex.hee.system.serialization.putPos
import chylex.hee.system.serialization.use
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.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.util.math.BlockPos
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 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 DEBUFF_SPEED = AttributeModifier(UUID.fromString("9BEF400C-05DD-49A7-91E1-036EF7B73766"), "Tainted speed debuff", -0.33, 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)
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 nextSpawnCooldown = 0
val clientEntity by lazy { createClientEntity() }
val clientEntity by lazy(::createClientEntity)
val clientRotation = LerpedFloat(0F)
protected abstract val clientRotationSpeed: Float
@@ -180,9 +180,9 @@ abstract class TileEntityBaseSpawner(type: TileEntityType<out TileEntityBaseSpaw
protected fun spawnMob(entity: EntityLiving){
if (isTainted){
entity.heeTag.putBoolean(ENTITY_TAINTED_TAG, true)
entity.getAttribute(MAX_HEALTH)?.applyModifier(BUFF_HEALTH)
entity.getAttribute(MOVEMENT_SPEED)?.applyModifier(DEBUFF_SPEED)
entity.getAttribute(FLYING_SPEED)?.applyModifier(DEBUFF_SPEED)
entity.getAttribute(MAX_HEALTH)?.applyPersistentModifier(BUFF_HEALTH)
entity.getAttribute(MOVEMENT_SPEED)?.applyPersistentModifier(DEBUFF_SPEED)
entity.getAttribute(FLYING_SPEED)?.applyPersistentModifier(DEBUFF_SPEED)
entity.health = entity.maxHealth
}

View File

@@ -24,6 +24,7 @@ object FluidEnderGoo : FluidBase(
override fun props(properties: Properties): Properties = with(properties){
block { ModBlocks.ENDER_GOO }
bucket { ModItems.ENDER_GOO_BUCKET }
tickRate(18)
}
override fun constructFlowingFluid(properties: Properties) = FlowingFluid5(properties)

View File

@@ -24,6 +24,7 @@ object FluidEnderGooPurified : FluidBase(
override fun props(properties: Properties): Properties = with(properties){
block { ModBlocks.PURIFIED_ENDER_GOO }
bucket { ModItems.PURIFIED_ENDER_GOO_BUCKET }
tickRate(16)
}
override fun constructFlowingFluid(properties: Properties) = FlowingFluid5(properties)

View File

@@ -2,5 +2,5 @@ package chylex.hee.game.block.properties
import net.minecraftforge.common.PlantType
object CustomPlantType{
val END: PlantType = PlantType.create("HEE_END")
val END: PlantType = PlantType.get("HEE_END")
}

View File

@@ -42,7 +42,7 @@ import net.minecraft.network.PacketBuffer
import net.minecraft.util.SoundCategory
import net.minecraft.util.SoundEvent
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.minecraftforge.common.MinecraftForge
import net.minecraftforge.event.entity.living.EnderTeleportEvent
@@ -66,8 +66,8 @@ class Teleporter(
private val PARTICLE_MOT = InBox(0.035F)
class FxTeleportData(
private val startPoint: Vec3d,
private val endPoint: Vec3d,
private val startPoint: Vector3d,
private val endPoint: Vector3d,
private val width: Float,
private val height: Float,
private val soundEvent: SoundEvent,
@@ -145,7 +145,7 @@ class Teleporter(
// 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)
if (postEvent && MinecraftForge.EVENT_BUS.post(event)){
@@ -166,7 +166,7 @@ class Teleporter(
val world = entity.world
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)
entity.setPositionAndUpdate(newPos.x, newPos.y, newPos.z)
@@ -222,14 +222,14 @@ class Teleporter(
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 originalPos = entity.posVec
val originalBox = entity.boundingBox
repeat(attempts){
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)))){
return toLocation(entity, newPos, soundCategory)
@@ -239,7 +239,7 @@ class Teleporter(
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)
}

View File

@@ -28,7 +28,7 @@ import net.minecraft.network.IPacket
import net.minecraft.network.PacketBuffer
import net.minecraft.tileentity.TileEntity
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.World
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData
@@ -52,7 +52,7 @@ open class EntityFallingBlockHeavy(type: EntityType<out EntityFallingBlockHeavy>
prevPosX = x
prevPosY = y
prevPosZ = z
motion = Vec3d.ZERO
motion = Vector3d.ZERO
}
companion object{

View File

@@ -2,6 +2,7 @@ package chylex.hee.game.entity.item
import chylex.hee.game.block.asVoxelShape
import chylex.hee.game.block.properties.BlockBuilder.Companion.INDESTRUCTIBLE_HARDNESS
import chylex.hee.game.entity.motionY
import chylex.hee.game.entity.posVec
import chylex.hee.game.item.ItemFlintAndInfernium
import chylex.hee.game.item.infusion.Infusion.FIRE
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.Items
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.particles.ParticleTypes.SMOKE
import net.minecraft.util.ReuseableStream
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.ISelectionContext
import net.minecraft.util.math.shapes.VoxelShapes
import net.minecraft.util.math.vector.Vector3d
import net.minecraft.world.Explosion
import net.minecraft.world.IWorldReader
import net.minecraft.world.World
import net.minecraft.world.chunk.ChunkStatus
import net.minecraft.world.chunk.IChunk
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 java.util.stream.Stream
import kotlin.math.PI
@@ -76,11 +77,11 @@ class EntityInfusedTNT : EntityTNTPrimed{
// 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)
}
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 {
if (it == null)
constructRawItem(world, pos, stack)
@@ -159,7 +160,7 @@ class EntityInfusedTNT : EntityTNTPrimed{
// Phasing
override fun move(type: MoverType, by: Vec3d){
override fun move(type: MoverType, by: Vector3d){
val wasNoclip = noClip
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 (motion.lengthSquared() == 0.0){
return motion
@@ -295,7 +296,7 @@ class EntityInfusedTNT : EntityTNTPrimed{
val lootTable = Environment.getLootTable(LootTables.GAMEPLAY_FISHING)
val lootContext = LootContext.Builder(world as ServerWorld)
.withRandom(rand)
.withParameter(LootParameters.POSITION, position)
.withParameter(LootParameters.field_237457_g_, posVec)
.withParameter(LootParameters.TOOL, ItemStack(Items.FISHING_ROD))
.build(LootParameterSets.FISHING)
@@ -310,7 +311,7 @@ class EntityInfusedTNT : EntityTNTPrimed{
)
constructItemEntity(world, dropPos, droppedItem).apply {
motion = Vec3d(
motion = Vector3d(
rand.nextFloat(-0.25, 0.25),
rand.nextFloat(1.0, 1.2),
rand.nextFloat(-0.25, 0.25)

View File

@@ -6,7 +6,7 @@ import net.minecraft.entity.Entity
import net.minecraft.entity.EntityType
import net.minecraft.item.ItemStack
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.minecraftforge.fml.network.NetworkHooks
@@ -17,7 +17,7 @@ abstract class EntityItemBase(type: EntityType<out EntityItemBase>, world: World
}
@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
rotationYaw = rand.nextFloat(0F, 360F)

View File

@@ -32,7 +32,7 @@ import net.minecraft.item.ItemStack
import net.minecraft.util.SoundCategory
import net.minecraft.util.math.AxisAlignedBB
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 java.util.Random
import kotlin.math.min
@@ -87,7 +87,7 @@ class EntityItemCauldronTrigger : EntityItemBase{
pos.setBlock(world, Blocks.CAULDRON)
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()
world.addEntity(this)
}

View File

@@ -11,14 +11,14 @@ import net.minecraft.entity.EntityType
import net.minecraft.item.ItemStack
import net.minecraft.network.PacketBuffer
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.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData
class EntityItemFreshlyCooked : EntityItemBase, IEntityAdditionalSpawnData{
@Suppress("unused")
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 const val STOP_SMOKING_AFTER_TICKS = 20 * 90

View File

@@ -83,7 +83,7 @@ import net.minecraft.util.Direction
import net.minecraft.util.SoundCategory
import net.minecraft.util.SoundEvent
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.server.ServerWorld
import java.util.Random
@@ -146,7 +146,7 @@ class EntityItemIgneousRock : EntityItemNoBob{
}
private var throwFacing = DOWN
private var prevMotion = Vec3d.ZERO
private var prevMotion = Vector3d.ZERO
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){
super.move(type, by.mul(0.2, 0.01, 0.2))
}

View File

@@ -38,7 +38,7 @@ import net.minecraft.network.datasync.DataSerializers
import net.minecraft.util.DamageSource
import net.minecraft.util.SoundCategory
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.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData
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) }
if (droppedToken != null){

View File

@@ -1,6 +1,8 @@
package chylex.hee.game.entity.living
import chylex.hee.game.entity.CustomCreatureType
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.Melee
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.EntityType
import net.minecraft.entity.ILivingEntityData
import net.minecraft.entity.MobEntity
import net.minecraft.entity.Pose
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.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.SpawnReason
import net.minecraft.entity.ai.attributes.AttributeModifierMap.MutableAttribute
import net.minecraft.entity.ai.controller.BodyController
import net.minecraft.entity.monster.IMob
import net.minecraft.nbt.CompoundNBT
@@ -83,10 +87,11 @@ import net.minecraft.util.DamageSource
import net.minecraft.util.ResourceLocation
import net.minecraft.util.math.AxisAlignedBB
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.world.BossInfo
import net.minecraft.world.DifficultyInstance
import net.minecraft.world.IServerWorld
import net.minecraft.world.IWorld
import net.minecraft.world.World
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 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
@@ -196,6 +208,8 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
health = maxHealth * 0.5F
bossInfo.percent = 0.5F
experienceValue = 50
}
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)
}
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(){
getAttribute(ATTACK_DAMAGE).baseValue = 4.0 * damageMultiplier
getAttribute(ATTACK_DAMAGE)!!.baseValue = 4.0 * damageMultiplier
experienceValue = (50 * experienceMultiplier).floorToInt()
}
@@ -281,8 +281,8 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
else{
val distanceFromTargetSq = getDistanceSq(currentTarget)
if (distanceFromTargetSq > square(getAttribute(FOLLOW_RANGE).value * 0.75)){
val closerRange = getAttribute(FOLLOW_RANGE).value * 0.375
if (distanceFromTargetSq > square(getAttributeValue(FOLLOW_RANGE) * 0.75)){
val closerRange = getAttributeValue(FOLLOW_RANGE) * 0.375
val closerCandidate = rand.nextItemOrNull(world.selectVulnerableEntities.inRange<EntityPlayer>(posVec, closerRange).filter(::canEntityBeSeen))
if (closerCandidate != null){
@@ -318,7 +318,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
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
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)
rotationYawHead = yaw
motion = Vec3d.ZERO
motion = Vector3d.ZERO
}
}
@@ -387,7 +387,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
return attacker
}
val range = getAttribute(FOLLOW_RANGE).value
val range = getAttributeValue(FOLLOW_RANGE)
val targets = world.selectVulnerableEntities.inRange<EntityPlayer>(posVec, range).filter(::canEntityBeSeen)
return rng.nextItemOrNull(targets).also { attackTarget = it }
@@ -411,7 +411,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
lastHitKnockbackMultiplier = attack.dealtKnockbackMultiplier
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)
}
@@ -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)
if (target is EntityLivingBase){
target.knockBack(this, strength, ratio.x, ratio.z)
target.applyKnockback(strength, ratio.x, ratio.z)
if (target is EntityPlayer){
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
}
@@ -496,7 +496,7 @@ class EntityBossEnderEye(type: EntityType<EntityBossEnderEye>, world: World) : E
return EntityBodyHeadOnly(this)
}
override fun moveRelative(friction: Float, dir: Vec3d){
override fun moveRelative(friction: Float, dir: Vector3d){
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)
}
override fun knockBack(entity: Entity, strength: Float, xRatio: Double, zRatio: Double){
override fun applyKnockback(strength: Float, ratioX: Double, ratioZ: Double){
val bossPhase = bossPhase
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){
super.knockBack(entity, strength * 1.4F, xRatio, zRatio)
super.applyKnockback(strength * 1.4F, ratioX, ratioZ)
bossPhase.currentAttack = KnockbackDash()
knockbackDashChance = 7
lastKnockbackDashTime = world.totalTime
}
else if (!ForgeHooks.onLivingKnockBack(this, entity, strength, xRatio, zRatio).isCanceled){
motion = motion.add(Vec3.fromXZ(-xRatio, -zRatio).normalize().scale(KNOCKBACK_MP).withY(0.005))
else if (!ForgeHooks.onLivingKnockBack(this, strength, ratioX, ratioZ).isCanceled){
motion = motion.add(Vec3.fromXZ(-ratioX, -ratioZ).normalize().scale(KNOCKBACK_MP).withY(0.005))
if (motionY > 0.05){
motionY = 0.05

View File

@@ -15,7 +15,7 @@ import net.minecraft.entity.Entity
import net.minecraft.entity.EntitySize
import net.minecraft.entity.EntityType
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.datasync.DataSerializers
import net.minecraft.util.DamageSource

View File

@@ -1,4 +1,6 @@
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.Swim
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.math.offsetTowards
import chylex.hee.system.math.square
import chylex.hee.system.migration.EntityEnderman
import chylex.hee.system.migration.EntityPlayer
import chylex.hee.system.serialization.TagCompound
import chylex.hee.system.serialization.heeTag
import chylex.hee.system.serialization.use
import net.minecraft.entity.EntityPredicate
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.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.util.ResourceLocation
import net.minecraft.util.math.AxisAlignedBB
import net.minecraft.util.math.RayTraceContext
import net.minecraft.util.math.RayTraceContext.BlockMode
import net.minecraft.util.math.RayTraceContext.FluidMode
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.World
class EntityMobAngryEnderman(type: EntityType<EntityMobAngryEnderman>, world: World) : EntityMobAbstractEnderman(type, world){
constructor(world: World) : this(ModEntities.ANGRY_ENDERMAN, world)
private companion object{
companion object{
private const val TELEPORT_HANDLER_TAG = "Teleport"
private const val WATER_HANDLER_TAG = "Water"
private const val DESPAWN_COOLDOWN_TAG = "DespawnCooldown"
private const val AGGRO_DISTANCE = 12
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
@@ -51,14 +61,7 @@ class EntityMobAngryEnderman(type: EntityType<EntityMobAngryEnderman>, world: Wo
override val teleportCooldown = 35
private var despawnCooldown = 300
override fun registerAttributes(){
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
init{
experienceValue = 7
}
@@ -83,7 +86,7 @@ class EntityMobAngryEnderman(type: EntityType<EntityMobAngryEnderman>, world: Wo
if (currentTarget != null){
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
}
else if (distanceSq > AGGRO_DISTANCE_SQ){
@@ -111,7 +114,7 @@ class EntityMobAngryEnderman(type: EntityType<EntityMobAngryEnderman>, world: Wo
}
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
}

View File

@@ -1,5 +1,7 @@
package chylex.hee.game.entity.living
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.Companion.addGoal
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.ILivingEntityData
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.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.item.ItemStack
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.SoundEvent
import net.minecraft.world.DifficultyInstance
import net.minecraft.world.IWorld
import net.minecraft.world.IServerWorld
import net.minecraft.world.World
import net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY
import net.minecraftforge.fml.network.NetworkHooks
import java.util.Random
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)
}
}
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
@@ -191,7 +201,7 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
private lateinit var aiLeaderDisabledToggle: AIToggle
private val isFollowRangeAreaLoaded
get() = world.isAreaLoaded(Pos(this), getAttribute(FOLLOW_RANGE).value.ceilToInt())
get() = world.isAreaLoaded(Pos(this), getAttributeValue(FOLLOW_RANGE).ceilToInt())
// Initialization
@@ -199,6 +209,8 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
moveController = EntityMoveJumping(this, ::getJumpDelay, degreeDiffBeforeMovement = 22.5)
lookController = EntityLookWhileJumping(this)
experienceValue = 1
setPathPriority(PathNodeType.WATER, 2F)
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)
}
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){
getAttribute(MAX_HEALTH).baseValue = maxHealth.toDouble()
getAttribute(MAX_HEALTH)!!.baseValue = maxHealth.toDouble()
health = if (resetCurrentHealth)
maxHealth
@@ -262,7 +263,7 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
private fun recreateGroup(){
val originalGroup = world
.selectExistingEntities
.inRange<EntityMobBlobby>(posVec, getAttribute(FOLLOW_RANGE).value)
.inRange<EntityMobBlobby>(posVec, getAttributeValue(FOLLOW_RANGE))
.filter { it.groupId == groupId }
.ifEmpty { listOf(this) }
@@ -289,7 +290,7 @@ class EntityMobBlobby(type: EntityType<out EntityCreature>, world: World) : Enti
}
fun findLeader(): EntityMobBlobby?{
val maxDist = getAttribute(FOLLOW_RANGE).value
val maxDist = getAttributeValue(FOLLOW_RANGE)
val checkArea = boundingBox.grow(maxDist, maxDist * 0.5, maxDist)
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
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 wrld = world.world
val group = (data as? SpawnGroupData) ?: SpawnGroupData(rand)

View File

@@ -1,5 +1,7 @@
package chylex.hee.game.entity.living
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.AIToggle
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.math.square
import chylex.hee.system.migration.EntityArrow
import chylex.hee.system.migration.EntityEnderman
import chylex.hee.system.migration.EntityLiving
import chylex.hee.system.migration.EntityLivingBase
import chylex.hee.system.migration.EntityLlamaSpit
@@ -43,10 +46,10 @@ import chylex.hee.system.serialization.use
import net.minecraft.block.BlockState
import net.minecraft.entity.EntityClassification.MONSTER
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.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.util.DamageSource
import net.minecraft.util.IndirectEntityDamageSource
@@ -184,7 +187,7 @@ class EntityMobEnderman(type: EntityType<EntityMobEnderman>, world: World) : Ent
return false
}
return !world.dimension.isSurfaceWorld || checkSkylightLevel(world, rand)
return !world.dimensionType.isSurfaceWorld || checkSkylightLevel(world, rand)
}
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))
}
// Attributes
fun createAttributes() = EntityEnderman.func_233666_p_().extend {
add(MAX_HEALTH, 40.0)
add(ATTACK_DAMAGE, 5.0)
add(FOLLOW_RANGE, 64.0)
}
}
// Instance
@@ -224,13 +235,7 @@ class EntityMobEnderman(type: EntityType<EntityMobEnderman>, world: World) : Ent
// Initialization
override fun registerAttributes(){
super.registerAttributes()
getAttribute(MAX_HEALTH).baseValue = 40.0
getAttribute(ATTACK_DAMAGE).baseValue = 5.0
getAttribute(FOLLOW_RANGE).baseValue = 64.0
init{
experienceValue = 10
}

View File

@@ -1,4 +1,6 @@
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.INVALID
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.world.Pos
import chylex.hee.init.ModEntities
import chylex.hee.system.migration.EntityEnderman
import chylex.hee.system.serialization.TagCompound
import chylex.hee.system.serialization.getEnum
import chylex.hee.system.serialization.heeTag
import chylex.hee.system.serialization.putEnum
import chylex.hee.system.serialization.use
import net.minecraft.entity.EntityType
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
import net.minecraft.entity.SharedMonsterAttributes.MOVEMENT_SPEED
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
import net.minecraft.entity.ai.attributes.Attributes.MOVEMENT_SPEED
import net.minecraft.world.World
class EntityMobEndermanMuppet(type: EntityType<EntityMobEndermanMuppet>, world: World) : EntityMobAbstractEnderman(type, world){
@@ -23,8 +26,13 @@ class EntityMobEndermanMuppet(type: EntityType<EntityMobEndermanMuppet>, world:
this.type = type
}
private companion object{
companion object{
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{
@@ -37,12 +45,7 @@ class EntityMobEndermanMuppet(type: EntityType<EntityMobEndermanMuppet>, world:
override val teleportCooldown = Int.MAX_VALUE
private var type = INVALID
override fun registerAttributes(){
super.registerAttributes()
getAttribute(MAX_HEALTH).baseValue = 40.0
getAttribute(MOVEMENT_SPEED).baseValue = 0.0
init{
experienceValue = 0
}

View File

@@ -1,5 +1,7 @@
package chylex.hee.game.entity.living
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.ForceWanderTiming
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.Entity
import net.minecraft.entity.EntityType
import net.minecraft.entity.SharedMonsterAttributes.ATTACK_DAMAGE
import net.minecraft.entity.SharedMonsterAttributes.MAX_HEALTH
import net.minecraft.entity.ai.attributes.Attributes.ATTACK_DAMAGE
import net.minecraft.entity.ai.attributes.Attributes.MAX_HEALTH
import net.minecraft.network.IPacket
import net.minecraft.util.ResourceLocation
import net.minecraft.world.Difficulty.PEACEFUL
@@ -33,22 +35,22 @@ open class EntityMobEndermite(type: EntityType<out EntityMobEndermite>, world: W
@Suppress("unused")
constructor(world: World) : this(ModEntities.ENDERMITE, world)
private companion object{
companion object{
private val DAMAGE_GENERAL = Damage(DIFFICULTY_SCALING, PEACEFUL_EXCLUSION, *ALL_PROTECTIONS)
private const val AGE_TAG = "Age"
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 idleDespawnTimer: Short = 0
override fun registerAttributes(){
super.registerAttributes()
getAttribute(MAX_HEALTH).baseValue = 8.0
getAttribute(ATTACK_DAMAGE).baseValue = 2.0
init{
experienceValue = 3
}

View File

@@ -1,5 +1,7 @@
package chylex.hee.game.entity.living
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.AITargetSwarmSwitch
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.entity.Entity
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.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.IPacket
import net.minecraft.util.DamageSource
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
@@ -82,13 +90,7 @@ class EntityMobSilverfish(type: EntityType<EntityMobSilverfish>, world: World) :
override var wasLastHitCritical = false
override fun registerAttributes(){
super.registerAttributes()
getAttribute(MAX_HEALTH).baseValue = 8.0
getAttribute(ATTACK_DAMAGE).baseValue = 2.0
getAttribute(FOLLOW_RANGE).baseValue = 12.0
init{
experienceValue = 3
}

View File

@@ -1,6 +1,8 @@
package chylex.hee.game.entity.living
import chylex.hee.game.entity.EntityData
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.AIToggle
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.selectVulnerableEntities
import chylex.hee.game.entity.tryApplyModifier
import chylex.hee.game.entity.tryApplyNonPersistentModifier
import chylex.hee.game.entity.tryRemoveModifier
import chylex.hee.game.mechanics.damage.Damage
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.Entity
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.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.datasync.DataSerializers
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.FluidMode
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.NORMAL
import net.minecraft.world.LightType.BLOCK
@@ -118,6 +121,13 @@ class EntityMobSpiderling(type: EntityType<EntityMobSpiderling>, world: World) :
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
@@ -144,7 +154,11 @@ class EntityMobSpiderling(type: EntityType<EntityMobSpiderling>, world: World) :
// Initialization
init{
experienceValue = 2
stepHeight = 0F
// TODO
getAttribute(MAX_HEALTH)!!.baseValue = rand.nextInt(11, 13).toDouble()
}
override fun registerData(){
@@ -152,17 +166,6 @@ class EntityMobSpiderling(type: EntityType<EntityMobSpiderling>, world: World) :
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(){
aiMovement = AIToggle()
aiMovement.enabled = false
@@ -245,7 +248,7 @@ class EntityMobSpiderling(type: EntityType<EntityMobSpiderling>, world: World) :
}
else{
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 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)
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
}
override fun setMotionMultiplier(state: BlockState, mp: Vec3d){
override fun setMotionMultiplier(state: BlockState, mp: Vector3d){
if (state.block !is BlockWeb){
super.setMotionMultiplier(state, mp)
}

View File

@@ -1,4 +1,6 @@
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.Swim
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.EntityType
import net.minecraft.entity.Pose
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.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.util.DamageSource
import net.minecraft.util.Hand
@@ -44,18 +46,18 @@ class EntityMobUndread(type: EntityType<EntityMobUndread>, world: World) : Entit
@Suppress("unused")
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)
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(){
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
init{
experienceValue = 5
}

View File

@@ -1,5 +1,7 @@
package chylex.hee.game.entity.living
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.living.EntityMobVampireBat.BehaviorType.HOSTILE
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.EntityType
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.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.nbt.CompoundNBT
import net.minecraft.network.IPacket
import net.minecraft.util.SoundCategory
import net.minecraft.util.math.AxisAlignedBB
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.NORMAL
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.World
import net.minecraftforge.fml.network.NetworkHooks
@@ -78,7 +80,7 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
@Suppress("unused")
constructor(world: World) : this(ModEntities.VAMPIRE_BAT, world)
private companion object{
companion object{
private const val MIN_ATTACK_COOLDOWN = 30
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),
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{
@@ -106,9 +115,9 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
// Instance
private var behaviorType = NEUTRAL
private var prevTargetPos: Vec3d? = null
private var prevTargetPos: Vector3d? = null
private val nextTargetPos: Vec3d
private val nextTargetPos: Vector3d
get(){
val currentTarget = attackTarget
@@ -119,7 +128,7 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
val currentSleep = nextSleepPos
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 }
@@ -130,7 +139,7 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
rand.nextInt(-2, 4),
rand.nextInt(-7, 7)
).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 {
prevTargetPos = it
}
@@ -151,28 +160,18 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
init{
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()
}
private fun updateHostilityAttributes(){
if (behaviorType == PASSIVE){
getAttribute(MAX_HEALTH).baseValue = 6.0
getAttribute(ATTACK_DAMAGE).baseValue = 0.0
getAttribute(MAX_HEALTH)!!.baseValue = 6.0
getAttribute(ATTACK_DAMAGE)!!.baseValue = 0.0
experienceValue = 0
}
else{
getAttribute(MAX_HEALTH).baseValue = 4.0
getAttribute(ATTACK_DAMAGE).baseValue = 3.0
getAttribute(MAX_HEALTH)!!.baseValue = 4.0
getAttribute(ATTACK_DAMAGE)!!.baseValue = 3.0
experienceValue = 1
}
@@ -214,7 +213,7 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
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
}
}
@@ -255,7 +254,7 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
else if (lookPosVec.squareDistanceTo(sleepPos.center) < square(0.2) && canHangUnderCurrentBlock()){
isBatHanging = true
nextSleepPos = null
motion = Vec3d.ZERO
motion = Vector3d.ZERO
moveHelper.tick()
moveForward = 0F
@@ -370,10 +369,10 @@ class EntityMobVampireBat(type: EntityType<EntityMobVampireBat>, world: World) :
// 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
if (world.dimension.type === HEE.dim){
if (world.world.dimensionKey === HEE.dim){
when(TerritoryType.fromX(posX.floorToInt())){
else -> {}
}

View File

@@ -22,7 +22,7 @@ import chylex.hee.system.serialization.heeTag
import chylex.hee.system.serialization.readTag
import chylex.hee.system.serialization.use
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.merchant.villager.VillagerData
import net.minecraft.entity.villager.IVillagerDataHolder
@@ -69,16 +69,11 @@ class EntityMobVillagerDying(type: EntityType<EntityMobVillagerDying>, world: Wo
private var villager: VillagerData? = null
init{
experienceValue = 0
isInvulnerable = true
setNoGravity(true)
}
override fun registerAttributes(){
super.registerAttributes()
experienceValue = 0
}
fun copyVillagerDataFrom(villager: EntityVillager){
setGrowingAge(villager.growingAge)
this.villager = villager.villagerData
@@ -97,7 +92,7 @@ class EntityMobVillagerDying(type: EntityType<EntityMobVillagerDying>, world: Wo
}
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)
writeFloat(renderYawOffset)
@@ -106,7 +101,7 @@ class EntityMobVillagerDying(type: EntityType<EntityMobVillagerDying>, world: Wo
}
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()
renderYawOffset = readFloat()
@@ -159,13 +154,13 @@ class EntityMobVillagerDying(type: EntityType<EntityMobVillagerDying>, world: Wo
override fun writeAdditional(nbt: TagCompound) = nbt.heeTag.use {
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 {
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

View File

@@ -35,7 +35,7 @@ class AIAttackLeap(
}
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
}
@@ -60,7 +60,7 @@ class AIAttackLeap(
}
override fun shouldContinueExecuting(): Boolean{
return !entity.onGround
return !entity.isOnGround
}
override fun startExecuting(){

View File

@@ -12,15 +12,15 @@ import chylex.hee.system.random.nextVector2
import net.minecraft.entity.ai.goal.Goal
import net.minecraft.entity.ai.goal.Goal.Flag.JUMP
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 kotlin.math.abs
class AIFollowLeaderJumping(private val entity: EntityMobBlobby) : Goal(){
private var leader: EntityMobBlobby? = null
private var offset = Vec3d.ZERO
private var targetOffset = Vec3d.ZERO
private var offset = Vector3d.ZERO
private var targetOffset = Vector3d.ZERO
private var offsetChangeTicks = 0
private var stoppedTicks = 0

View File

@@ -12,7 +12,7 @@ import chylex.hee.system.random.nextInt
import net.minecraft.block.BlockState
import net.minecraft.entity.ai.goal.Goal
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.vector.Vector3d
class AIPickUpBlock(
private val entity: EntityCreature,
@@ -27,7 +27,7 @@ class AIPickUpBlock(
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 targetBlockState: BlockState? = null
@@ -55,7 +55,7 @@ class AIPickUpBlock(
targetBlockPos = pos
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
}

View File

@@ -2,7 +2,7 @@ package chylex.hee.game.entity.living.ai
import chylex.hee.system.migration.EntityCreature
import net.minecraft.entity.ai.RandomPositionGenerator
import net.minecraft.entity.ai.goal.RandomWalkingGoal
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.vector.Vector3d
class AIWander(
entity: EntityCreature,
@@ -11,7 +11,7 @@ class AIWander(
private val maxDistanceXZ: Int = 10,
private val maxDistanceY: Int = 7
) : RandomWalkingGoal(entity, movementSpeed, chancePerTick){
override fun getPosition(): Vec3d?{
override fun getPosition(): Vector3d?{
return RandomPositionGenerator.findRandomTarget(creature, maxDistanceXZ, maxDistanceY)
}
}

View File

@@ -2,7 +2,7 @@ package chylex.hee.game.entity.living.ai
import chylex.hee.system.migration.EntityCreature
import net.minecraft.entity.ai.RandomPositionGenerator
import net.minecraft.entity.ai.goal.RandomWalkingGoal
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.vector.Vector3d
open class AIWanderLand(
entity: EntityCreature,
@@ -14,7 +14,7 @@ open class AIWanderLand(
protected inline val entity: EntityCreature
get() = creature
override fun getPosition(): Vec3d?{
override fun getPosition(): Vector3d?{
return RandomPositionGenerator.getLandPos(entity, maxDistanceXZ, maxDistanceY) ?: RandomPositionGenerator.findRandomTarget(entity, maxDistanceXZ, maxDistanceY)
}
}

View File

@@ -6,7 +6,7 @@ import chylex.hee.system.migration.EntityCreature
import chylex.hee.system.random.nextInt
import net.minecraft.pathfinding.Path
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.SKY
@@ -58,7 +58,7 @@ class AIWanderLightStartle(
return false
}
override fun getPosition(): Vec3d?{
override fun getPosition(): Vector3d?{
val world = entity.world
val rand = entity.rng
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{

View File

@@ -8,7 +8,7 @@ import chylex.hee.system.migration.Facing.UP
import chylex.hee.system.random.nextInt
import net.minecraft.block.material.Material
import net.minecraft.entity.ai.RandomPositionGenerator
import net.minecraft.util.math.Vec3d
import net.minecraft.util.math.vector.Vector3d
class AIWanderOnFirePanic(
entity: EntityCreature,
@@ -35,7 +35,7 @@ class AIWanderOnFirePanic(
return entity.isBurning && !entity.navigator.noPath()
}
override fun getPosition(): Vec3d?{
override fun getPosition(): Vector3d?{
val world = entity.world
val rand = entity.rng

View File

@@ -4,14 +4,14 @@ import chylex.hee.game.entity.lookPosVec
import net.minecraft.entity.ai.goal.Goal
import net.minecraft.entity.ai.goal.Goal.Flag.LOOK
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
class AIWatchDyingLeader(
private val entity: EntityMobBlobby,
private val ticksBeforeResuming: Int
) : Goal(){
private var watchTarget = Vec3d.ZERO
private var watchTarget = Vector3d.ZERO
private var remainingTicks = 0
init{
@@ -37,7 +37,7 @@ class AIWatchDyingLeader(
}
override fun resetTask(){
watchTarget = Vec3d.ZERO
watchTarget = Vector3d.ZERO
remainingTicks = 0
}
}

View File

@@ -14,7 +14,7 @@ class AIWatchIdleJumping(private val entity: EntityLiving, private val chancePer
}
override fun shouldExecute(): Boolean{
return entity.onGround && entity.rng.nextFloat() < chancePerTick
return entity.isOnGround && entity.rng.nextFloat() < chancePerTick
}
override fun shouldContinueExecuting(): Boolean{
@@ -28,7 +28,7 @@ class AIWatchIdleJumping(private val entity: EntityLiving, private val chancePer
override fun tick(){
if (delayTicksRemaining > 0){
if (!entity.onGround){
if (!entity.isOnGround){
delayTicksRemaining = 0
}
else if (--delayTicksRemaining == 0){
@@ -39,7 +39,7 @@ class AIWatchIdleJumping(private val entity: EntityLiving, private val chancePer
else{
super.tick()
if (entity.onGround){
if (entity.isOnGround){
delayTicksRemaining = 0
}
}

View File

@@ -1,6 +1,8 @@
package chylex.hee.game.entity.living.behavior
import chylex.hee.HEE
import chylex.hee.client.MC
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.living.EntityBossEnderEye
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.util.SoundCategory
import net.minecraft.util.math.BlockPos
import net.minecraft.world.dimension.DimensionType
import net.minecraftforge.common.util.INBTSerializable
import java.util.Random
import kotlin.math.min
@@ -97,7 +98,7 @@ sealed class EnderEyePhase : INBTSerializable<TagCompound>{
else if (timer < 0){
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)
}

View File

@@ -22,7 +22,7 @@ import chylex.hee.system.serialization.use
import chylex.hee.system.serialization.writeVec
import net.minecraft.network.PacketBuffer
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.minecraftforge.common.util.INBTSerializable
import java.util.Random
@@ -46,7 +46,7 @@ class EnderEyeSpawnerParticles(private val entity: EntityBossEnderEye) : INBTSer
hideOnMinimalSetting = false
)
class ParticleData(private val point: Vec3d) : IFxData{
class ParticleData(private val point: Vector3d) : IFxData{
override fun write(buffer: PacketBuffer) = buffer.use {
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>{
constructor() : this(Vec3d.ZERO, 0, 0F)
private class ParticleInstance(pos: Vector3d, delay: Int, private var originalDistanceXZ: Float) : INBTSerializable<TagCompound>{
constructor() : this(Vector3d.ZERO, 0, 0F)
var pos = pos
private set
@@ -112,7 +112,7 @@ class EnderEyeSpawnerParticles(private val entity: EntityBossEnderEye) : INBTSer
}
override fun deserializeNBT(nbt: TagCompound) = nbt.use {
pos = Vec3d(
pos = Vector3d(
getDouble(X_TAG),
getDouble(Y_TAG),
getDouble(Z_TAG)
@@ -129,7 +129,7 @@ class EnderEyeSpawnerParticles(private val entity: EntityBossEnderEye) : INBTSer
private val particles = mutableListOf<ParticleInstance>()
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
for(particle in particles){

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