diff --git a/build.gradle b/build.gradle index ff552b5c..e05d708d 100644 --- a/build.gradle +++ b/build.gradle @@ -143,6 +143,7 @@ dependencies { compileOnly "curse.maven:mysticalmechanics-300742:3006392" compileOnly "mezz.jei:jei_${mc_version}:${jei_version}:api" compileOnly "curse.maven:crafttweaker-239197:5354089" + compileOnly files("libs/Hwyla-1.8.26-B41_1.12.2-api.jar") implementation "mezz.jei:jei_${mc_version}:${jei_version}" } diff --git a/libs/Hwyla-1.8.26-B41_1.12.2-api.jar b/libs/Hwyla-1.8.26-B41_1.12.2-api.jar new file mode 100644 index 00000000..1249e320 Binary files /dev/null and b/libs/Hwyla-1.8.26-B41_1.12.2-api.jar differ diff --git a/src/main/java/anightdazingzoroark/prift/client/ui/RiftEggMenu.java b/src/main/java/anightdazingzoroark/prift/client/ui/RiftEggMenu.java index aaf7ca47..1c61364b 100644 --- a/src/main/java/anightdazingzoroark/prift/client/ui/RiftEggMenu.java +++ b/src/main/java/anightdazingzoroark/prift/client/ui/RiftEggMenu.java @@ -207,10 +207,11 @@ public void renderEgg(int posX, int posY, int scaleValue, float renderYaw, float GlStateManager.rotate(-45.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.rotate(-135.0F, 0.0F, 0.0F, 0.0F); + GlStateManager.rotate(-180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(-((float) Math.atan(renderPitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); egg.rotationYaw = (float) Math.atan(renderYaw / 40.0F) * 40.0F; egg.rotationPitch = -((float) Math.atan(renderPitch / 40.0F)) * 20.0F; - GlStateManager.translate(0.0F, (float) egg.getYOffset(), 0.0F); + GlStateManager.translate(0.0F, -0.125F, 0.0F); GlStateManager.rotate(egg.ticksExisted, 0.0F, 1.0F, 0.0F); Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F; Minecraft.getMinecraft().getRenderManager().renderEntity(egg, 0.0D, 0.0D, 0.0D, 0.0F, 0F, false); @@ -230,10 +231,12 @@ else if (this.hatchable instanceof RiftSac) { GlStateManager.rotate(-45.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.rotate(-135.0F, 0.0F, 0.0F, 0.0F); + GlStateManager.rotate(-180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(-((float) Math.atan(renderPitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); sac.rotationYaw = (float) Math.atan(renderYaw / 40.0F) * 40.0F; sac.rotationPitch = -((float) Math.atan(renderPitch / 40.0F)) * 20.0F; GlStateManager.translate(0.0F, (float) sac.getYOffset(), 0.0F); + GlStateManager.translate(0.0F, -0.125F, 0.0F); GlStateManager.rotate(sac.ticksExisted, 0.0F, 1.0F, 0.0F); Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F; Minecraft.getMinecraft().getRenderManager().renderEntity(sac, 0.0D, 0.0D, 0.0D, 0.0F, 0F, false); @@ -253,10 +256,12 @@ else if (this.hatchable instanceof IImpregnable) { GlStateManager.rotate(-45.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.rotate(-135.0F, 0.0F, 0.0F, 0.0F); + GlStateManager.rotate(-180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(-((float) Math.atan(renderPitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); embryo.rotationYaw = (float) Math.atan(renderYaw / 40.0F) * 40.0F; embryo.rotationPitch = -((float) Math.atan(renderPitch / 40.0F)) * 20.0F; GlStateManager.translate(0.0F, (float) embryo.getYOffset(), 0.0F); + GlStateManager.translate(0.0F, -0.225F, 0.0F); GlStateManager.rotate(this.embryoRotation++, 0.0F, 1.0F, 0.0F); Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F; Minecraft.getMinecraft().getRenderManager().renderEntity(embryo, 0.0D, 0.0D, 0.0D, 0.0F, 0F, false); diff --git a/src/main/java/anightdazingzoroark/prift/client/ui/RiftSemiManualPresserMenu.java b/src/main/java/anightdazingzoroark/prift/client/ui/RiftSemiManualPresserMenu.java index 95efa484..cfa6aa2a 100644 --- a/src/main/java/anightdazingzoroark/prift/client/ui/RiftSemiManualPresserMenu.java +++ b/src/main/java/anightdazingzoroark/prift/client/ui/RiftSemiManualPresserMenu.java @@ -46,6 +46,7 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { private void drawProgressBar() { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float progress = (float)this.semiManualPresser.getTopTEntity().getTimeHeld(); + System.out.println("progress: "+progress); float max = (float)this.semiManualPresser.getTopTEntity().getMaxRecipeTime(); float fill = progress / max * 21f; this.mc.getTextureManager().bindTexture(progressBar); diff --git a/src/main/java/anightdazingzoroark/prift/compat/hwyla/RiftHWYLA.java b/src/main/java/anightdazingzoroark/prift/compat/hwyla/RiftHWYLA.java new file mode 100644 index 00000000..85ef59a3 --- /dev/null +++ b/src/main/java/anightdazingzoroark/prift/compat/hwyla/RiftHWYLA.java @@ -0,0 +1,44 @@ +package anightdazingzoroark.prift.compat.hwyla; + +import anightdazingzoroark.prift.RiftInitialize; +import anightdazingzoroark.prift.compat.hwyla.provider.RiftBlowPoweredTurbineProvider; +import anightdazingzoroark.prift.compat.hwyla.provider.RiftCrankProvider; +import anightdazingzoroark.prift.compat.hwyla.provider.RiftCreaturePartProvider; +import anightdazingzoroark.prift.compat.hwyla.provider.RiftSemiManualMachineProvider; +import anightdazingzoroark.prift.compat.mysticalmechanics.tileentities.*; +import anightdazingzoroark.prift.config.GeneralConfig; +import anightdazingzoroark.prift.server.entity.creature.RiftCreaturePart; +import mcp.mobius.waila.api.IWailaPlugin; +import mcp.mobius.waila.api.IWailaRegistrar; +import mcp.mobius.waila.api.WailaPlugin; + +@WailaPlugin(RiftInitialize.MODID) +public class RiftHWYLA implements IWailaPlugin { + @Override + public void register(IWailaRegistrar registrar) { + RiftCreaturePartProvider creaturePartProvider = new RiftCreaturePartProvider(); + registrar.registerHeadProvider(creaturePartProvider, RiftCreaturePart.class); + registrar.registerBodyProvider(creaturePartProvider, RiftCreaturePart.class); + registrar.registerTailProvider(creaturePartProvider, RiftCreaturePart.class); + + if (GeneralConfig.canUseMM()) { + RiftBlowPoweredTurbineProvider turbineProvider = new RiftBlowPoweredTurbineProvider(); + registrar.registerBodyProvider(turbineProvider, TileEntityBlowPoweredTurbine.class); + registrar.registerBodyProvider(turbineProvider, TileEntityBlowPoweredTurbinePart.class); + + RiftCrankProvider leadPoweredCrankProvider = new RiftCrankProvider(); + registrar.registerBodyProvider(leadPoweredCrankProvider, TileEntityHandCrank.class); + registrar.registerBodyProvider(leadPoweredCrankProvider, TileEntityLeadPoweredCrank.class); + + RiftSemiManualMachineProvider smPresserProvider = new RiftSemiManualMachineProvider(); + registrar.registerBodyProvider(smPresserProvider, TileEntitySemiManualExtractor.class); + registrar.registerBodyProvider(smPresserProvider, TileEntitySemiManualExtractorTop.class); + registrar.registerBodyProvider(smPresserProvider, TileEntitySemiManualPresser.class); + registrar.registerBodyProvider(smPresserProvider, TileEntitySemiManualPresserTop.class); + registrar.registerBodyProvider(smPresserProvider, TileEntitySemiManualExtruder.class); + registrar.registerBodyProvider(smPresserProvider, TileEntitySemiManualExtruderTop.class); + registrar.registerBodyProvider(smPresserProvider, TileEntitySemiManualHammerer.class); + registrar.registerBodyProvider(smPresserProvider, TileEntitySemiManualHammererTop.class); + } + } +} diff --git a/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftBlowPoweredTurbineProvider.java b/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftBlowPoweredTurbineProvider.java new file mode 100644 index 00000000..be54df8d --- /dev/null +++ b/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftBlowPoweredTurbineProvider.java @@ -0,0 +1,32 @@ +package anightdazingzoroark.prift.compat.hwyla.provider; + +import anightdazingzoroark.prift.compat.mysticalmechanics.tileentities.TileEntityBlowPoweredTurbine; +import anightdazingzoroark.prift.compat.mysticalmechanics.tileentities.TileEntityBlowPoweredTurbinePart; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import javax.annotation.Nonnull; +import java.util.List; + +public class RiftBlowPoweredTurbineProvider implements IWailaDataProvider { + @Nonnull + @Override + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + TileEntity tileEntity = accessor.getTileEntity(); + if (tileEntity instanceof TileEntityBlowPoweredTurbine) { + TileEntityBlowPoweredTurbine turbine = (TileEntityBlowPoweredTurbine) tileEntity; + tooltip.add(I18n.format("hwyla.power_created", (int)turbine.getPower()+".0 R")); + } + else if (tileEntity instanceof TileEntityBlowPoweredTurbinePart) { + TileEntityBlowPoweredTurbinePart turbinePart = (TileEntityBlowPoweredTurbinePart)tileEntity; + TileEntityBlowPoweredTurbine turbine = turbinePart.getTurbine(); + int power = (int)turbine.getPower(); + tooltip.add(I18n.format("hwyla.power_created", power+".0 R")); + } + return tooltip; + } +} diff --git a/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftCrankProvider.java b/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftCrankProvider.java new file mode 100644 index 00000000..a94696f7 --- /dev/null +++ b/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftCrankProvider.java @@ -0,0 +1,30 @@ +package anightdazingzoroark.prift.compat.hwyla.provider; + +import anightdazingzoroark.prift.compat.mysticalmechanics.tileentities.TileEntityHandCrank; +import anightdazingzoroark.prift.compat.mysticalmechanics.tileentities.TileEntityLeadPoweredCrank; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import javax.annotation.Nonnull; +import java.util.List; + +public class RiftCrankProvider implements IWailaDataProvider { + @Nonnull + @Override + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + TileEntity tileEntity = accessor.getTileEntity(); + if (tileEntity instanceof TileEntityHandCrank) { + TileEntityHandCrank handCrank = (TileEntityHandCrank) tileEntity; + tooltip.add(I18n.format("hwyla.power_created", (int)handCrank.getPower()+".0 R")); + } + if (tileEntity instanceof TileEntityLeadPoweredCrank) { + TileEntityLeadPoweredCrank leadPoweredCrank = (TileEntityLeadPoweredCrank) tileEntity; + tooltip.add(I18n.format("hwyla.power_created", leadPoweredCrank.mechPower.getPower(null)+" R")); + } + return tooltip; + } +} diff --git a/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftCreaturePartProvider.java b/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftCreaturePartProvider.java new file mode 100644 index 00000000..0a4e55ac --- /dev/null +++ b/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftCreaturePartProvider.java @@ -0,0 +1,48 @@ +package anightdazingzoroark.prift.compat.hwyla.provider; + +import anightdazingzoroark.prift.RiftInitialize; +import anightdazingzoroark.prift.server.entity.creature.RiftCreaturePart; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaEntityAccessor; +import mcp.mobius.waila.api.IWailaEntityProvider; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.Entity; +import net.minecraft.util.text.TextFormatting; + +import javax.annotation.Nonnull; +import java.util.List; + +public class RiftCreaturePartProvider implements IWailaEntityProvider { + @Nonnull + @Override + public List getWailaHead(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) { + currenttip.clear(); + RiftCreaturePart part = (RiftCreaturePart) entity; + if (part != null) { + String creatureName = TextFormatting.WHITE + part.getParent().getName(false); + String level = TextFormatting.GRAY + I18n.format("tametrait.level", part.getParent().getLevel()); + currenttip.add(creatureName + " (" + level + ")"); + } + return currenttip; + } + + @Nonnull + @Override + public List getWailaBody(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) { + RiftCreaturePart part = (RiftCreaturePart) entity; + if (part != null && config.getConfig("general.showhp")) { + int currentHealth = (int)part.getParent().getHealth(); + int maxHealth = (int)part.getParent().getMaxHealth(); + currenttip.add(I18n.format("hwyla.health", currentHealth, maxHealth)); + } + return currenttip; + } + + @Nonnull + @Override + public List getWailaTail(Entity entity, List currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) { + currenttip.clear(); + currenttip.add(TextFormatting.BLUE + "" + TextFormatting.ITALIC + RiftInitialize.MODNAME); + return currenttip; + } +} diff --git a/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftSemiManualMachineProvider.java b/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftSemiManualMachineProvider.java new file mode 100644 index 00000000..0296125c --- /dev/null +++ b/src/main/java/anightdazingzoroark/prift/compat/hwyla/provider/RiftSemiManualMachineProvider.java @@ -0,0 +1,30 @@ +package anightdazingzoroark.prift.compat.hwyla.provider; + +import anightdazingzoroark.prift.compat.mysticalmechanics.tileentities.TileEntitySemiManualBase; +import anightdazingzoroark.prift.compat.mysticalmechanics.tileentities.TileEntitySemiManualTopBase; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import javax.annotation.Nonnull; +import java.util.List; + +public class RiftSemiManualMachineProvider implements IWailaDataProvider { + @Nonnull + @Override + public List getWailaBody(ItemStack itemStack, List tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + TileEntity tileEntity = accessor.getTileEntity(); + if (tileEntity instanceof TileEntitySemiManualBase) { + TileEntitySemiManualBase baseTE = (TileEntitySemiManualBase) tileEntity; + tooltip.add(I18n.format("hwyla.power_consumed", (int)baseTE.getTopTEntity().getPower()+".0 R")); + } + else if (tileEntity instanceof TileEntitySemiManualTopBase) { + TileEntitySemiManualTopBase topTe = (TileEntitySemiManualTopBase) tileEntity; + tooltip.add(I18n.format("hwyla.power_consumed", (int)topTe.getPower()+".0 R")); + } + return tooltip; + } +} diff --git a/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntityBlowPoweredTurbine.java b/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntityBlowPoweredTurbine.java index af771979..159e0d7b 100644 --- a/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntityBlowPoweredTurbine.java +++ b/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntityBlowPoweredTurbine.java @@ -12,6 +12,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.common.capabilities.Capability; import software.bernie.geckolib3.core.IAnimatable; import software.bernie.geckolib3.core.PlayState; @@ -197,4 +198,9 @@ private PlayState rotation(AnimationEvent event) { public AnimationFactory getFactory() { return this.factory; } + + @Override + public AxisAlignedBB getRenderBoundingBox() { + return new AxisAlignedBB(this.getPos().add(-1, -1, -1), this.getPos().add(1, 2, 1)); + } } diff --git a/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntityBlowPoweredTurbinePart.java b/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntityBlowPoweredTurbinePart.java index 4e694508..d450f522 100644 --- a/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntityBlowPoweredTurbinePart.java +++ b/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntityBlowPoweredTurbinePart.java @@ -21,6 +21,10 @@ public void setCenterBlockPos(BlockPos centerBlockPos) { } } + public TileEntityBlowPoweredTurbine getTurbine() { + return (TileEntityBlowPoweredTurbine) this.world.getTileEntity(this.getCenterBlockPos()); + } + @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); @@ -36,6 +40,11 @@ public void readFromNBT(NBTTagCompound compound) { this.centerBlockPos = new BlockPos(compound.getInteger("centerPosX"), compound.getInteger("centerPosY"), compound.getInteger("centerPosZ")); } + @Override + public NBTTagCompound getUpdateTag() { + return this.writeToNBT(new NBTTagCompound()); + } + @Override public void handleUpdateTag(NBTTagCompound tag) { this.centerBlockPos = new BlockPos(tag.getInteger("centerPosX"), tag.getInteger("centerPosY"), tag.getInteger("centerPosZ")); diff --git a/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntitySemiManualPresser.java b/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntitySemiManualPresser.java index 4df7b009..66f3e6d5 100644 --- a/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntitySemiManualPresser.java +++ b/src/main/java/anightdazingzoroark/prift/compat/mysticalmechanics/tileentities/TileEntitySemiManualPresser.java @@ -1,12 +1,8 @@ package anightdazingzoroark.prift.compat.mysticalmechanics.tileentities; import anightdazingzoroark.prift.compat.mysticalmechanics.recipes.RiftMMRecipes; -import anightdazingzoroark.prift.compat.mysticalmechanics.recipes.SemiManualExtruderRecipe; import anightdazingzoroark.prift.compat.mysticalmechanics.recipes.SemiManualPresserRecipe; import net.minecraft.item.ItemStack; -import net.minecraftforge.items.CapabilityItemHandler; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemHandlerHelper; public class TileEntitySemiManualPresser extends TileEntitySemiManualBase { public TileEntitySemiManualPresser() { diff --git a/src/main/java/anightdazingzoroark/prift/server/ServerProxy.java b/src/main/java/anightdazingzoroark/prift/server/ServerProxy.java index f9486710..6f453f47 100644 --- a/src/main/java/anightdazingzoroark/prift/server/ServerProxy.java +++ b/src/main/java/anightdazingzoroark/prift/server/ServerProxy.java @@ -72,6 +72,7 @@ public void preInit(FMLPreInitializationEvent e) { RiftItems.registerItems(); RiftTileEntities.registerTileEntities(); RiftItems.registerOreDicTags(); + RiftBlocks.registerOreDicTags(); RiftRecipes.registerSmelting(); if (GeneralConfig.canUseMM()) RiftMMRecipes.registerRecipes(); RiftCrafttweaker.loadCrafttweakerCompat(); diff --git a/src/main/java/anightdazingzoroark/prift/server/blocks/RiftBlocks.java b/src/main/java/anightdazingzoroark/prift/server/blocks/RiftBlocks.java index 0a1171f8..a26ab7a7 100644 --- a/src/main/java/anightdazingzoroark/prift/server/blocks/RiftBlocks.java +++ b/src/main/java/anightdazingzoroark/prift/server/blocks/RiftBlocks.java @@ -14,6 +14,7 @@ import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.registries.IForgeRegistry; import java.util.ArrayList; @@ -44,6 +45,11 @@ public static void registerBlocks() { if (GeneralConfig.canUseMM()) RiftMMBlocks.registerMMBlocks(); } + public static void registerOreDicTags() { + OreDictionary.registerOre("grass", RiftBlocks.PYROBERRY_BUSH); + OreDictionary.registerOre("grass", RiftBlocks.CRYOBERRY_BUSH); + } + public static Block registerBlock(Block block, String registryName, boolean includeItem) { return registerBlock(block, registryName, includeItem, true, true); } diff --git a/src/main/java/anightdazingzoroark/prift/server/entity/ai/RiftAttack.java b/src/main/java/anightdazingzoroark/prift/server/entity/ai/RiftAttack.java index 4eb7c652..ad60f544 100644 --- a/src/main/java/anightdazingzoroark/prift/server/entity/ai/RiftAttack.java +++ b/src/main/java/anightdazingzoroark/prift/server/entity/ai/RiftAttack.java @@ -142,27 +142,29 @@ protected void checkAndPerformAttack(EntityLivingBase enemy, double distToEnemyS if (--this.attackCooldown <= 0) { if (distToEnemySqr <= d0) this.attacker.setAttacking(true); - if (this.animTime == 0) this.attacker.removeSpeed(); - this.animTime++; - if (this.animTime == this.attackAnimTime) { - if (distToEnemySqr <= d0) this.attacker.attackEntityAsMob(enemy); - } - if (this.animTime > this.attackAnimLength + 1) { - this.animTime = 0; - this.attacker.setAttacking(false); - this.attackCooldown = 20; - this.attacker.resetSpeed(); - if (this.attacker.isTamed()) this.attacker.energyActionMod++; + if (this.attacker.isAttacking()) { + this.animTime++; + if (this.animTime == this.attackAnimTime) { + this.attacker.removeSpeed(); + if (distToEnemySqr <= d0) this.attacker.attackEntityAsMob(enemy); + } + if (this.animTime > this.attackAnimLength + 1) { + this.animTime = 0; + this.attacker.setAttacking(false); + this.attackCooldown = 20; + this.attacker.resetSpeed(); + if (this.attacker.isTamed()) this.attacker.energyActionMod++; + } } } } protected double getAttackReachSqr(EntityLivingBase attackTarget) { - return (double)(this.attacker.attackWidth * this.attacker.attackWidth + attackTarget.width); + return (this.attacker.attackWidth * this.attacker.attackWidth + attackTarget.width); } protected double getRangedAttackReachSqr(EntityLivingBase attackTarget) { - if (this.attacker instanceof IRangedAttackMob) return (double)(this.attacker.rangedWidth * this.attacker.rangedWidth + attackTarget.width); + if (this.attacker instanceof IRangedAttackMob) return (double)(this.attacker.rangedWidth * this.attacker.rangedWidth + attackTarget.width + 25); return 0; } diff --git a/src/main/java/anightdazingzoroark/prift/server/entity/ai/RiftChargeAttack.java b/src/main/java/anightdazingzoroark/prift/server/entity/ai/RiftChargeAttack.java index 739b1efb..b152d16a 100644 --- a/src/main/java/anightdazingzoroark/prift/server/entity/ai/RiftChargeAttack.java +++ b/src/main/java/anightdazingzoroark/prift/server/entity/ai/RiftChargeAttack.java @@ -53,6 +53,9 @@ public boolean shouldExecute() { else if (!entitylivingbase.isEntityAlive()) return false; else { double d0 = this.attacker.getDistanceSq(entitylivingbase.posX, entitylivingbase.getEntityBoundingBox().minY, entitylivingbase.posZ); + System.out.println("min charge: "+this.getAttackReachSqr(entitylivingbase)); + System.out.println("target dist: "+d0); + System.out.println("max charge: "+this.getChargeAttackReachSqr(entitylivingbase)); return this.attacker.getEnergy() > 6 && d0 > this.getAttackReachSqr(entitylivingbase) && d0 <= this.getChargeAttackReachSqr(entitylivingbase) && !this.attacker.isInWater(); } } @@ -198,7 +201,7 @@ else if (entity instanceof RiftCreaturePart) { } protected double getAttackReachSqr(EntityLivingBase attackTarget) { - return (double)(this.attacker.attackWidth * this.attacker.attackWidth + attackTarget.width); + return (double)(this.attacker.attackWidth * this.attacker.attackWidth + attackTarget.width + 25); } protected double getChargeAttackReachSqr(EntityLivingBase attackTarget) { diff --git a/src/main/java/anightdazingzoroark/prift/server/entity/creature/Parasaurolophus.java b/src/main/java/anightdazingzoroark/prift/server/entity/creature/Parasaurolophus.java index e60deb04..205515fd 100644 --- a/src/main/java/anightdazingzoroark/prift/server/entity/creature/Parasaurolophus.java +++ b/src/main/java/anightdazingzoroark/prift/server/entity/creature/Parasaurolophus.java @@ -100,7 +100,7 @@ protected void initEntityAI() { this.targetTasks.addTask(2, new RiftProtectOwner(this)); this.targetTasks.addTask(3, new RiftAttackForOwner(this)); this.tasks.addTask(0, new RiftParasaurStokeCombustor(this)); - this.tasks.addTask(0, new RiftBlowIntoTurbine(this, 10f, 1.76f, 0.24f)); + this.tasks.addTask(0, new RiftBlowIntoTurbine(this, 64f, 1.76f, 0.24f)); this.tasks.addTask(0, new RiftUseLeadPoweredCrank(this)); this.tasks.addTask(1, new RiftMate(this)); this.tasks.addTask(2, new RiftLandDwellerSwim(this)); diff --git a/src/main/java/anightdazingzoroark/prift/server/entity/creature/RiftCreature.java b/src/main/java/anightdazingzoroark/prift/server/entity/creature/RiftCreature.java index a737a050..32290f21 100644 --- a/src/main/java/anightdazingzoroark/prift/server/entity/creature/RiftCreature.java +++ b/src/main/java/anightdazingzoroark/prift/server/entity/creature/RiftCreature.java @@ -642,7 +642,6 @@ public String getName(boolean includeLevel) { else { String s = EntityList.getEntityString(this); if (s == null) s = "generic"; - //new TextComponentTranslation("tametrait.level", this.getLevel()).getFormattedText() return new TextComponentTranslation("entity." + s + ".name").getFormattedText() + (includeLevel ? " ("+ new TextComponentTranslation("tametrait.level", this.getLevel()).getFormattedText()+")" : ""); } } @@ -1708,7 +1707,7 @@ public int slotCount() { } public void updatePassenger(Entity passenger) { - if (this.canBeSteered()) { + if (this.canBeSteered() && !this.isCharging()) { this.rotationYaw = passenger.rotationYaw; this.prevRotationYaw = this.rotationYaw; this.rotationPitch = passenger.rotationPitch * 0.5f; @@ -1868,11 +1867,13 @@ public void travel(float strafe, float vertical, float forward) { if (this.isSaddled() && this.isBeingRidden() && this.canBeSteered()) { EntityLivingBase controller = (EntityLivingBase)this.getControllingPassenger(); if (controller != null) { - this.rotationYaw = controller.rotationYaw; - this.prevRotationYaw = this.rotationYaw; - this.rotationPitch = controller.rotationPitch * 0.5f; - this.setRotation(this.rotationYaw, this.rotationPitch); - this.renderYawOffset = this.rotationYaw; + if (!this.isCharging()) { + this.rotationYaw = controller.rotationYaw; + this.prevRotationYaw = this.rotationYaw; + this.rotationPitch = controller.rotationPitch * 0.5f; + this.setRotation(this.rotationYaw, this.rotationPitch); + this.renderYawOffset = this.rotationYaw; + } strafe = controller.moveStrafing * 0.5f; forward = controller.moveForward; this.stepHeight = 1.0F; diff --git a/src/main/java/anightdazingzoroark/prift/server/entity/creature/Tyrannosaurus.java b/src/main/java/anightdazingzoroark/prift/server/entity/creature/Tyrannosaurus.java index 1e58aa1c..5a762f8f 100644 --- a/src/main/java/anightdazingzoroark/prift/server/entity/creature/Tyrannosaurus.java +++ b/src/main/java/anightdazingzoroark/prift/server/entity/creature/Tyrannosaurus.java @@ -176,7 +176,7 @@ protected void initEntityAI() { this.targetTasks.addTask(2, new RiftProtectOwner(this)); this.targetTasks.addTask(3, new RiftPickUpFavoriteFoods(this,true)); this.targetTasks.addTask(3, new RiftAttackForOwner(this)); - this.tasks.addTask(0, new RiftBlowIntoTurbine(this, 30f, 2.08f, 0.64f)); + this.tasks.addTask(0, new RiftBlowIntoTurbine(this, 180f, 2.08f, 0.64f)); this.tasks.addTask(1, new RiftLandDwellerSwim(this)); this.tasks.addTask(2, new RiftMate(this)); this.tasks.addTask(3, new RiftResetAnimatedPose(this, 1.68F, 1)); diff --git a/src/main/java/anightdazingzoroark/prift/server/entity/interfaces/IImpregnable.java b/src/main/java/anightdazingzoroark/prift/server/entity/interfaces/IImpregnable.java index c23af019..b6add510 100644 --- a/src/main/java/anightdazingzoroark/prift/server/entity/interfaces/IImpregnable.java +++ b/src/main/java/anightdazingzoroark/prift/server/entity/interfaces/IImpregnable.java @@ -26,7 +26,7 @@ default void createBaby(T parent) { baby.setLocationAndAngles(parent.posX, parent.posY, parent.posZ, 0.0F, 0.0F); parent.world.spawnEntity(baby); this.setPregnant(false, 0); - ((EntityPlayer)parent.getOwner()).sendStatusMessage(new TextComponentTranslation("prift.notify.baby_birthed", new TextComponentString(parent.getName())), false); + if (parent.getOwner() != null) ((EntityPlayer)parent.getOwner()).sendStatusMessage(new TextComponentTranslation("prift.notify.baby_birthed", new TextComponentString(parent.getName())), false); } } } diff --git a/src/main/java/anightdazingzoroark/prift/server/recipes/RiftIngredientBucketFluid.java b/src/main/java/anightdazingzoroark/prift/server/recipes/RiftIngredientBucketFluid.java index e6fad41d..7dbee828 100644 --- a/src/main/java/anightdazingzoroark/prift/server/recipes/RiftIngredientBucketFluid.java +++ b/src/main/java/anightdazingzoroark/prift/server/recipes/RiftIngredientBucketFluid.java @@ -1,6 +1,5 @@ package anightdazingzoroark.prift.server.recipes; -import com.codetaylor.mc.athenaeum.recipe.IngredientFluidStack; import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; import net.minecraft.item.ItemStack; @@ -76,7 +75,7 @@ public Ingredient parse(JsonContext context, JsonObject json) { throw new JsonSyntaxException("Fluid with name " + name + " could not be found"); } - return new IngredientFluidStack(fluid, amount); + return new RiftIngredientFluidStack(fluid, amount); } } } diff --git a/src/main/java/anightdazingzoroark/prift/server/recipes/RiftIngredientFluidStack.java b/src/main/java/anightdazingzoroark/prift/server/recipes/RiftIngredientFluidStack.java new file mode 100644 index 00000000..3815567f --- /dev/null +++ b/src/main/java/anightdazingzoroark/prift/server/recipes/RiftIngredientFluidStack.java @@ -0,0 +1,81 @@ +package anightdazingzoroark.prift.server.recipes; + +import com.google.gson.JsonObject; +import com.google.gson.JsonSyntaxException; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.util.JsonUtils; +import net.minecraftforge.common.crafting.IIngredientFactory; +import net.minecraftforge.common.crafting.JsonContext; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidUtil; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class RiftIngredientFluidStack extends Ingredient { + private final FluidStack fluid; + private ItemStack[] cachedStacks; + + public RiftIngredientFluidStack(FluidStack fluid) { + + super(0); + this.fluid = fluid; + } + + public RiftIngredientFluidStack(Fluid fluid, int amount) { + + this(new FluidStack(fluid, amount)); + } + + public FluidStack getFluid() { + + return fluid; + } + + @Nonnull + @Override + public ItemStack[] getMatchingStacks() { + + if (this.cachedStacks == null) { + this.cachedStacks = new ItemStack[]{FluidUtil.getFilledBucket(this.fluid)}; + } + return this.cachedStacks; + } + + @Override + public boolean apply(@Nullable ItemStack stack) { + + if (stack == null) { + return false; + + } else { + FluidStack fs = FluidUtil.getFluidContained(stack); + return fs == null + && this.fluid == null + || fs != null + && fs.containsFluid(fluid); + } + } + + public static class Factory + implements IIngredientFactory { + + @Nonnull + @Override + public Ingredient parse(JsonContext context, JsonObject json) { + + String name = JsonUtils.getString(json, "fluid"); + int amount = JsonUtils.getInt(json, "amount", 1000); + Fluid fluid = FluidRegistry.getFluid(name); + + if (fluid == null) { + throw new JsonSyntaxException("Fluid with name " + name + " could not be found"); + } + + return new RiftIngredientFluidStack(fluid, amount); + } + } +} diff --git a/src/main/resources/assets/prift/lang/en_us.lang b/src/main/resources/assets/prift/lang/en_us.lang index d2803dbc..83bb4ab7 100644 --- a/src/main/resources/assets/prift/lang/en_us.lang +++ b/src/main/resources/assets/prift/lang/en_us.lang @@ -304,4 +304,8 @@ tile.feeding_trough.name=Feeding Trough tile.semi_manual_extractor.name=Semi Automatic Extractor tile.semi_manual_presser.name=Semi Automatic Presser tile.semi_manual_extruder.name=Semi Automatic Extruder -tile.semi_manual_hammerer.name=Semi Automatic Hammerer \ No newline at end of file +tile.semi_manual_hammerer.name=Semi Automatic Hammerer + +hwyla.health=Health: %s / %s +hwyla.power_consumed=Power Consumed: %s +hwyla.power_created=Power Created: %s \ No newline at end of file diff --git a/src/main/resources/assets/prift/recipes/cryoberry_juice_bucket.json b/src/main/resources/assets/prift/recipes/cryoberry_juice_bucket.json new file mode 100644 index 00000000..0550dbda --- /dev/null +++ b/src/main/resources/assets/prift/recipes/cryoberry_juice_bucket.json @@ -0,0 +1,36 @@ +{ + "type": "forge:ore_shapeless", + "ingredients": [ + { + "item": "minecraft:bucket" + }, + { + "item": "prift:cryoberry" + }, + { + "item": "prift:cryoberry" + }, + { + "item": "prift:cryoberry" + }, + { + "item": "prift:cryoberry" + }, + { + "item": "prift:cryoberry" + }, + { + "item": "prift:cryoberry" + }, + { + "item": "prift:cryoberry" + }, + { + "item": "prift:cryoberry" + } + ], + "result": { + "item": "forge:bucketfilled", + "nbt": "{FluidName:\"cryoberry_juice\", Amount: 1000}" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/prift/recipes/pyroberry_juice_bucket.json b/src/main/resources/assets/prift/recipes/pyroberry_juice_bucket.json new file mode 100644 index 00000000..39e8e181 --- /dev/null +++ b/src/main/resources/assets/prift/recipes/pyroberry_juice_bucket.json @@ -0,0 +1,36 @@ +{ + "type": "forge:ore_shapeless", + "ingredients": [ + { + "item": "minecraft:bucket" + }, + { + "item": "prift:pyroberry" + }, + { + "item": "prift:pyroberry" + }, + { + "item": "prift:pyroberry" + }, + { + "item": "prift:pyroberry" + }, + { + "item": "prift:pyroberry" + }, + { + "item": "prift:pyroberry" + }, + { + "item": "prift:pyroberry" + }, + { + "item": "prift:pyroberry" + } + ], + "result": { + "item": "forge:bucketfilled", + "nbt": "{FluidName:\"pyroberry_juice\", Amount: 1000}" + } +} \ No newline at end of file