Merge branch 'monoliths' into 1.10-WIP
|
@ -2,14 +2,20 @@ package com.zixiken.dimdoors.client;
|
|||
|
||||
import com.zixiken.dimdoors.shared.DDProxyCommon;
|
||||
import com.zixiken.dimdoors.shared.ModelManager;
|
||||
import com.zixiken.dimdoors.shared.entities.MobMonolith;
|
||||
import com.zixiken.dimdoors.shared.entities.RenderMobObelisk;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityDimDoor;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityRift;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityTransTrapdoor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
|
@ -36,6 +42,13 @@ public class DDProxyClient extends DDProxyCommon {
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDimDoor.class, new RenderDimDoor());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTransTrapdoor.class, new RenderTransTrapdoor());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRift.class, new RenderRift());
|
||||
RenderingRegistry.registerEntityRenderingHandler(MobMonolith.class, new IRenderFactory<MobMonolith>()
|
||||
{
|
||||
@Override
|
||||
public Render<? super MobMonolith> createRenderFor(RenderManager manager) {
|
||||
return new RenderMobObelisk(manager, 0.5f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.zixiken.dimdoors.server.sound;
|
||||
|
||||
import com.zixiken.dimdoors.DimDoors;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class DDSounds {
|
||||
private DDSounds() {}
|
||||
|
||||
public static final SoundEvent CRACK = create("crack");
|
||||
|
||||
public static final SoundEvent CREEPY = create("creepy");
|
||||
|
||||
public static final SoundEvent DOOR_LOCKED = create("doorLocked");
|
||||
|
||||
public static final SoundEvent DOOR_LOCK_REMOVED = create("doorLockRemoved");
|
||||
|
||||
public static final SoundEvent KEY_LOCK = create("key");
|
||||
|
||||
public static final SoundEvent KEY_UNLOCKED = create("keyUnlock");
|
||||
|
||||
public static final SoundEvent MONK = create("monk");
|
||||
|
||||
public static final SoundEvent RIFT = create("rift");
|
||||
|
||||
public static final SoundEvent RIFT_CLOSE = create("riftClose");
|
||||
|
||||
public static final SoundEvent RIFT_DOOR = create("riftDoor");
|
||||
|
||||
public static final SoundEvent RIFT_END = create("riftEnd");
|
||||
|
||||
public static final SoundEvent RIFT_START = create("riftStart");
|
||||
|
||||
public static final SoundEvent TEARING = create("tearing");
|
||||
|
||||
private static final SoundEvent create(String name) {
|
||||
ResourceLocation id = new ResourceLocation(DimDoors.MODID, name);
|
||||
SoundEvent sound = new SoundEvent(id).setRegistryName(name);
|
||||
GameRegistry.register(sound);
|
||||
return sound;
|
||||
}
|
||||
}
|
|
@ -38,6 +38,9 @@ public class DDConfig {
|
|||
private static int[] doorRelativeDepths = new int[]{-1, 0, 1};
|
||||
private static int[] doorRelativeDepthWeights = new int[]{20, 30, 50};
|
||||
|
||||
private static boolean DangerousLimboMonolithsDisabled = true;
|
||||
private static boolean MonolithTeleportationEnabled = true;
|
||||
|
||||
private static int setConfigIntWithMaxAndMin(Configuration config, String category, String key, int defaultValue, String comment, int minValue, int maxValue) {
|
||||
Property prop = config.get(category, key, defaultValue,
|
||||
comment, minValue, maxValue);
|
||||
|
@ -104,6 +107,12 @@ public class DDConfig {
|
|||
"List of weights (chances) of the relative depths in doorRelativeDepths. This list needs to have the same size.");
|
||||
doorRelativeDepthWeights = prop.getIntList();
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "dangerousLimboMonolithsDisabled", DangerousLimboMonolithsDisabled,
|
||||
"Is Monoliths Dangerous in Limbo disabled?");
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "dangerousLimboMonolithsDisabled", MonolithTeleportationEnabled,
|
||||
"Is Monolith Teleportation disabled?");
|
||||
|
||||
checkAndCorrectDoorRelativeDepths(config);
|
||||
|
||||
// Save config
|
||||
|
@ -144,7 +153,7 @@ public class DDConfig {
|
|||
}
|
||||
|
||||
public static List<String> getDungeonSchematicNames() {
|
||||
List<String> dungeonSchematicNamesArrayList = new ArrayList();
|
||||
List<String> dungeonSchematicNamesArrayList = new ArrayList<>();
|
||||
for (String dungeonSchematicName : dungeonSchematicNames) {
|
||||
dungeonSchematicNamesArrayList.add(dungeonSchematicName);
|
||||
}
|
||||
|
@ -189,4 +198,12 @@ public class DDConfig {
|
|||
public static int getMaxDungeonDepth() {
|
||||
return maxDungeonDepth;
|
||||
}
|
||||
|
||||
public static boolean isDangerousLimboMonolithsDisabled() {
|
||||
return DangerousLimboMonolithsDisabled;
|
||||
}
|
||||
|
||||
public static boolean isMonolithTeleportationEnabled() {
|
||||
return MonolithTeleportationEnabled;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.zixiken.dimdoors.shared;
|
||||
|
||||
import com.zixiken.dimdoors.DimDoors;
|
||||
import com.zixiken.dimdoors.shared.blocks.BlockDimDoorBase;
|
||||
import com.zixiken.dimdoors.shared.blocks.ModBlocks;
|
||||
import com.zixiken.dimdoors.shared.entities.MobMonolith;
|
||||
import com.zixiken.dimdoors.shared.items.ModItems;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityDimDoor;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityDimDoorChaos;
|
||||
|
@ -13,12 +15,14 @@ import com.zixiken.dimdoors.shared.tileentities.TileEntityTransTrapdoor;
|
|||
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public abstract class DDProxyCommon implements IDDProxy {
|
||||
|
@ -41,6 +45,9 @@ public abstract class DDProxyCommon implements IDDProxy {
|
|||
|
||||
@Override
|
||||
public void onInitialization(FMLInitializationEvent event) {
|
||||
EntityRegistry.registerModEntity(MobMonolith.class, "Monolith", 0, DimDoors.instance, 70, 1, true);
|
||||
EntityRegistry.registerEgg(MobMonolith.class, 0, 0xffffff);
|
||||
|
||||
CraftingManager.registerRecipes();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,305 @@
|
|||
package com.zixiken.dimdoors.shared.entities;
|
||||
|
||||
import com.zixiken.dimdoors.DimDoors;
|
||||
import com.zixiken.dimdoors.server.sound.DDSounds;
|
||||
import com.zixiken.dimdoors.shared.DDConfig;
|
||||
import com.zixiken.dimdoors.shared.TeleporterDimDoors;
|
||||
import com.zixiken.dimdoors.shared.util.Location;
|
||||
import com.zixiken.dimdoors.shared.world.PocketProvider;
|
||||
import com.zixiken.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static net.minecraft.network.datasync.DataSerializers.*;
|
||||
|
||||
public class MobMonolith extends EntityFlying implements IMob
|
||||
{
|
||||
private static final int MAX_AGGRO = 250;
|
||||
private static final int MAX_AGGRO_CAP = 100;
|
||||
private static final int MIN_AGGRO_CAP = 25;
|
||||
private static final int MAX_TEXTURE_STATE = 18;
|
||||
private static final int MAX_SOUND_COOLDOWN = 200;
|
||||
private static final int MAX_AGGRO_RANGE = 35;
|
||||
private static final DataParameter<Integer> AGGRO = EntityDataManager.<Integer>createKey(MobMonolith.class, VARINT);
|
||||
|
||||
private static final float WIDTH = 3f;
|
||||
private static final float HEIGHT = 3f;
|
||||
private static final float EYE_HEIGHT = HEIGHT / 2;
|
||||
|
||||
public float pitchLevel;
|
||||
private int aggro = 0;
|
||||
private int soundTime = 0;
|
||||
private final int aggroCap;
|
||||
|
||||
public MobMonolith(World world)
|
||||
{
|
||||
super(world);
|
||||
this.setSize(WIDTH, HEIGHT);
|
||||
this.noClip = true;
|
||||
this.aggroCap = MathHelper.getInt(this.rand, MIN_AGGRO_CAP, MAX_AGGRO_CAP);
|
||||
}
|
||||
|
||||
public boolean isDangerous() {
|
||||
return DDConfig.isMonolithTeleportationEnabled() && (world.provider instanceof WorldProviderLimbo || !DDConfig.isDangerousLimboMonolithsDisabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void damageEntity(DamageSource par1DamageSource, float par2) {}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource damageSource, float par2) {
|
||||
if (damageSource != DamageSource.inWall) {
|
||||
this.aggro = MAX_AGGRO;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBreatheUnderwater() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBox(Entity par1Entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDespawn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEntityAttributes() {
|
||||
super.applyEntityAttributes();
|
||||
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(57005);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePushed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEyeHeight() {
|
||||
return EYE_HEIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
// Add a short for the aggro level
|
||||
this.dataManager.register(AGGRO, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEntityAlive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityUpdate() {
|
||||
// Remove this Monolith if it's not in Limbo or in a pocket dimension
|
||||
if (!(this.world.provider instanceof WorldProviderLimbo)) {
|
||||
this.setDead();
|
||||
super.onEntityUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
super.onEntityUpdate();
|
||||
|
||||
// Check for players and update aggro levels even if there are no players in range
|
||||
EntityPlayer player = this.world.getClosestPlayerToEntity(this, MAX_AGGRO_RANGE);
|
||||
boolean visibility = (player != null) && player.canEntityBeSeen(this);
|
||||
this.updateAggroLevel(player, visibility);
|
||||
|
||||
// Change orientation and face a player if one is in range
|
||||
if (player != null)
|
||||
{
|
||||
this.facePlayer(player);
|
||||
if (!this.world.isRemote && isDangerous())
|
||||
{
|
||||
// Play sounds on the server side, if the player isn't in Limbo.
|
||||
// Limbo is excluded to avoid drowning out its background music.
|
||||
// Also, since it's a large open area with many Monoliths, some
|
||||
// of the sounds that would usually play for a moment would
|
||||
// keep playing constantly and would get very annoying.
|
||||
playSounds(player);
|
||||
}
|
||||
|
||||
if (visibility)
|
||||
{
|
||||
// Only spawn particles on the client side and outside Limbo
|
||||
if (world.isRemote && isDangerous()) {
|
||||
this.spawnParticles(player);
|
||||
}
|
||||
|
||||
// Teleport the target player if various conditions are met
|
||||
if (aggro >= MAX_AGGRO && !world.isRemote && DDConfig.isMonolithTeleportationEnabled() && !player.capabilities.isCreativeMode && isDangerous()) {
|
||||
this.aggro = 0;
|
||||
Location destination = WorldProviderLimbo.getLimboSkySpawn(player, world);
|
||||
TeleporterDimDoors.instance().teleport(player, destination);
|
||||
player.world.playSound(player, player.getPosition(), DDSounds.CRACK, SoundCategory.HOSTILE, 13, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAggroLevel(EntityPlayer player, boolean visibility) {
|
||||
// If we're working on the server side, adjust aggro level
|
||||
// If we're working on the client side, retrieve aggro level from dataWatcher
|
||||
if (!this.world.isRemote) {
|
||||
// Server side...
|
||||
// Rapidly increase the aggro level if this Monolith can see the player
|
||||
if (visibility) {
|
||||
if (world.provider instanceof WorldProviderLimbo) {
|
||||
if (isDangerous())
|
||||
aggro++;
|
||||
else
|
||||
aggro += 36;
|
||||
} else {
|
||||
// Aggro increases faster outside of Limbo
|
||||
aggro += 3;
|
||||
}
|
||||
} else {
|
||||
if (isDangerous()) {
|
||||
if (aggro > aggroCap) {
|
||||
// Decrease aggro over time
|
||||
aggro--;
|
||||
} else if (player != null && (aggro < aggroCap)) {
|
||||
// Increase aggro if a player is within range and aggro < aggroCap
|
||||
aggro++;
|
||||
}
|
||||
} else
|
||||
aggro -= 3;
|
||||
}
|
||||
// Clamp the aggro level
|
||||
int maxAggro = isDangerous()?MAX_AGGRO:180;
|
||||
aggro = (short) MathHelper.clamp(aggro, 0, maxAggro);
|
||||
this.dataManager.set(AGGRO, aggro);
|
||||
} else {
|
||||
// Client side...
|
||||
aggro = this.dataManager.get(AGGRO);
|
||||
}
|
||||
}
|
||||
|
||||
public int getTextureState()
|
||||
{
|
||||
// Determine texture state from aggro progress
|
||||
return MathHelper.clamp(MAX_TEXTURE_STATE * aggro / MAX_AGGRO, 0, MAX_TEXTURE_STATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays sounds at different levels of aggro, using soundTime to prevent too many sounds at once.
|
||||
* @param entityPlayer
|
||||
*/
|
||||
private void playSounds(EntityPlayer entityPlayer)
|
||||
{
|
||||
float aggroPercent = this.getAggroProgress();
|
||||
if (this.soundTime <= 0)
|
||||
{
|
||||
playSound(DDSounds.MONK, 1F, 1F);
|
||||
this.soundTime = 100;
|
||||
}
|
||||
if ((aggroPercent > 0.70) && this.soundTime < 100)
|
||||
{
|
||||
world.playSound(entityPlayer, entityPlayer.getPosition(), DDSounds.TEARING, SoundCategory.HOSTILE, 1F, (float) (1 + this.rand.nextGaussian()));
|
||||
this.soundTime = 100 + this.rand.nextInt(75);
|
||||
}
|
||||
if ((aggroPercent > 0.80) && this.soundTime < MAX_SOUND_COOLDOWN) {
|
||||
world.playSound(entityPlayer, entityPlayer.getPosition(), DDSounds.TEARING, SoundCategory.HOSTILE, 7, 1F);
|
||||
this.soundTime = 250;
|
||||
}
|
||||
this.soundTime--;
|
||||
}
|
||||
|
||||
private void spawnParticles(EntityPlayer player)
|
||||
{
|
||||
int count = 10 * aggro / MAX_AGGRO;
|
||||
for (int i = 1; i < count; ++i)
|
||||
{
|
||||
player.world.spawnParticle(EnumParticleTypes.PORTAL, player.posX + (this.rand.nextDouble() - 0.5D) * this.width,
|
||||
player.posY + this.rand.nextDouble() * player.height - 0.75D,
|
||||
player.posZ + (this.rand.nextDouble() - 0.5D) * player.width,
|
||||
(this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(),
|
||||
(this.rand.nextDouble() - 0.5D) * 2.0D);
|
||||
}
|
||||
}
|
||||
|
||||
public float getAggroProgress()
|
||||
{
|
||||
return ((float) aggro) / MAX_AGGRO;
|
||||
}
|
||||
|
||||
private void facePlayer(EntityPlayer player)
|
||||
{
|
||||
double d0 = player.posX - this.posX;
|
||||
double d1 = player.posZ - this.posZ;
|
||||
double d2 = (player.posY + player.getEyeHeight()) - (this.posY + this.getEyeHeight());
|
||||
double d3 = MathHelper.sqrt(d0 * d0 + d1 * d1);
|
||||
float f2 = (float)(Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F;
|
||||
this.pitchLevel = (float) -((Math.atan(d2/d3) )* 180.0D / Math.PI);
|
||||
this.rotationYaw = f2;
|
||||
this.rotationYawHead = f2;
|
||||
this.renderYawOffset = this.rotationYaw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound rootTag)
|
||||
{
|
||||
super.writeEntityToNBT(rootTag);
|
||||
rootTag.setInteger("Aggro", this.aggro);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound rootTag)
|
||||
{
|
||||
super.readEntityFromNBT(rootTag);
|
||||
|
||||
// Load Monoliths with half aggro so they don't teleport players instantly
|
||||
aggro = rootTag.getInteger("Aggro") / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCanSpawnHere() {
|
||||
List list = world.getEntitiesWithinAABBExcludingEntity(this, new AxisAlignedBB( this.posX-15, posY-4, this.posZ-15, this.posX+15, this.posY+15, this.posZ+15));
|
||||
|
||||
if (world.provider instanceof WorldProviderLimbo) {
|
||||
if(list.size() > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
else if(world.provider instanceof PocketProvider)
|
||||
{
|
||||
if (list.size() > 5 || world.canBlockSeeSky(new BlockPos(posX, posY, posZ))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return world.checkNoEntityCollision(getCollisionBoundingBox()) && world.getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(getCollisionBoundingBox());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.zixiken.dimdoors.shared.entities;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelMobObelisk extends ModelBase {
|
||||
ModelRenderer wholemonolith;
|
||||
Random rand = new Random();
|
||||
|
||||
public ModelMobObelisk() {
|
||||
textureWidth = 256;
|
||||
textureHeight = 256;
|
||||
|
||||
wholemonolith = new ModelRenderer(this, 0, 0);
|
||||
wholemonolith.addBox(-24F,-108F/1.3F, -6F, 48, 108, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
this.setRotationAngles(0, 0, 0, 0, 0,0, entity);
|
||||
|
||||
GL11.glScalef(((MobMonolith) entity).getRenderSizeModifier(), ((MobMonolith) entity).getRenderSizeModifier(), ((MobMonolith) entity).getRenderSizeModifier());
|
||||
wholemonolith.render(scale);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
package com.zixiken.dimdoors.shared.entities;
|
||||
|
||||
import com.zixiken.dimdoors.DimDoors;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderLivingEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderMobObelisk extends RenderLiving<MobMonolith> {
|
||||
protected ModelMobObelisk obeliskModel;
|
||||
|
||||
protected static final List<ResourceLocation> monolith_textures = Arrays.asList(
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith0.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith1.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith2.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith3.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith4.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith5.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith6.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith7.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith8.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith9.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith10.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith11.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith12.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith13.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith14.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith15.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith16.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith17.png"),
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith18.png"));
|
||||
|
||||
public RenderMobObelisk(RenderManager manager, float f) {
|
||||
super(manager, new ModelMobObelisk(), f);
|
||||
this.obeliskModel = (ModelMobObelisk)this.mainModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(MobMonolith monolith, double x, double y, double z, float par8, float par9) {
|
||||
final float minScaling = 0;
|
||||
final float maxScaling = 0.1f;
|
||||
|
||||
float aggroScaling = 0;
|
||||
if (monolith.isDangerous()) {
|
||||
// Use linear interpolation to scale how much jitter we want for our given aggro level
|
||||
aggroScaling = minScaling + (maxScaling - minScaling) * monolith.getAggroProgress();
|
||||
}
|
||||
|
||||
// Calculate jitter - include entity ID to give Monoliths individual jitters
|
||||
float time = ((Minecraft.getSystemTime() + 0xF1234568 * monolith.getEntityId()) % 200000) / 50.0F;
|
||||
|
||||
// We use random constants here on purpose just to get different wave forms
|
||||
double xJitter = aggroScaling * Math.sin(1.1f * time) * Math.sin(0.8f * time);
|
||||
double yJitter = aggroScaling * Math.sin(1.2f * time) * Math.sin(0.9f * time);
|
||||
double zJitter = aggroScaling * Math.sin(1.3f * time) * Math.sin(0.7f * time);
|
||||
|
||||
// Render with jitter
|
||||
this.render(monolith, x + xJitter, y + yJitter, z + zJitter, par8, par9);
|
||||
//this.renderLeash(entity, x, y, z, par8, par9);
|
||||
}
|
||||
|
||||
public void render(MobMonolith par1EntityLivingBase, double x, double y, double z, float par8, float par9)
|
||||
{
|
||||
if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this, x, y, z))) return;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
mainModel.swingProgress = getSwingProgress(par1EntityLivingBase, par9);
|
||||
|
||||
try {
|
||||
float interpolatedYaw = interpolateRotation(par1EntityLivingBase.prevRenderYawOffset, par1EntityLivingBase.renderYawOffset, par9);
|
||||
float interpolatedYawHead = interpolateRotation(par1EntityLivingBase.prevRotationYawHead, par1EntityLivingBase.rotationYawHead, par9);
|
||||
float rotation;
|
||||
float pitch = par1EntityLivingBase.prevRotationPitch + (par1EntityLivingBase.rotationPitch - par1EntityLivingBase.prevRotationPitch) * par9;
|
||||
renderLivingAt(par1EntityLivingBase, x, y, z);
|
||||
|
||||
rotation = this.handleRotationFloat(par1EntityLivingBase, par9);
|
||||
this.applyRotations(par1EntityLivingBase, rotation, interpolatedYaw, par9);
|
||||
|
||||
float f6 = 0.0625F;
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||
this.preRenderCallback(par1EntityLivingBase, par9);
|
||||
GL11.glRotatef(((MobMonolith)par1EntityLivingBase).pitchLevel , 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 24.0F * f6 - 0.0078125F, 0.0F);
|
||||
|
||||
|
||||
renderModel(par1EntityLivingBase, 0, 0, rotation, interpolatedYaw, pitch, f6);
|
||||
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this, x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(MobMonolith monolith) {
|
||||
return monolith_textures.get(monolith.getTextureState()); //return new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/Monolith" + monolith.getTextureState() + ".png");
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ import net.minecraftforge.common.DimensionManager;
|
|||
public class DimDoorDimensions {
|
||||
|
||||
public static DimensionType LIMBO;
|
||||
private static Map<EnumPocketType, DimensionType> pocketDimensionTypes = new HashMap();
|
||||
private static Map<EnumPocketType, DimensionType> pocketDimensionTypes = new HashMap<>();
|
||||
public static List<DimensionType> CUSTOM;
|
||||
|
||||
public static void init() {
|
||||
|
@ -35,7 +35,7 @@ public class DimDoorDimensions {
|
|||
registerDimension(pocketDimensionTypes.get(pocketType));
|
||||
}
|
||||
|
||||
CUSTOM = new ArrayList();
|
||||
CUSTOM = new ArrayList<>();
|
||||
for (int i = 0; i < 0; i++) { //@todo: For future use? Like, server owners can add their own set of DimDoors DimensionTypes via the configs? Or is this nonsense?
|
||||
dimID++;
|
||||
DimensionType tempType = DimensionType.register("Name", "_name", dimID, WorldProvider.class, false);
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
"crack": {"category":"hostile", "sounds":[{"name":"crack","stream":false}]},
|
||||
"creepy": {"category":"ambient", "sounds":[{"name":"creepy","stream":true}]},
|
||||
"doorLocked": {"category":"player", "sounds":[{"name":"doorLocked","stream":false}]},
|
||||
"doorLockRemoved": {"category":"player", "sounds":[{"name":"doorLockRemoved","stream":false}]},
|
||||
"keyLock": {"category":"player", "sounds":[{"name":"keyLock","stream":false}]},
|
||||
"keyUnlock": {"category":"player", "sounds":[{"name":"keyUnlock", "stream":false}]},
|
||||
"monk": {"category":"hostile", "sounds":[{"name":"monk", "stream":false}]},
|
||||
"rift": {"category":"master", "sounds":[{"name":"rift", "stream":false}]},
|
||||
"riftClose": {"category":"player", "sounds":[{"name":"riftClose", "stream":false}]},
|
||||
"riftDoor": {"category":"player", "sounds":[{"name":"riftDoor", "stream":false}]},
|
||||
"riftEnd": {"category":"player", "sounds":[{"name":"riftEnd", "stream":false}]},
|
||||
"riftStart": {"category":"player", "sounds":[{"name":"riftStart", "stream":false}]},
|
||||
"tearing": {"category":"hostile", "sounds":[{"name":"tearing", "stream":false}]}
|
||||
"crack" : { "sounds" : [ "dimdoors:crack"] },
|
||||
"creepy" : { "sounds" : ["dimdoors:creepy" ] },
|
||||
"doorLocked": { "sounds": [ "dimdoors:doorLocked" ] },
|
||||
"doorLockRemoved": { "sounds": [ "dimdoors:doorLockRemoved" ] },
|
||||
"keyLock" : { "sounds" : [ "dimdoors:keyLock" ] },
|
||||
"keyUnlock" : { "sounds": [ "dimdoors:keyUnlock" ] },
|
||||
"monk" : { "sounds" : [ "dimdoors:monk" ] },
|
||||
"rift" : { "sounds" : [ "dimdoors:rift" ] },
|
||||
"riftClose" : { "sounds" : [ "dimdoors:riftClose" ] },
|
||||
"riftDoor": { "sounds" : [ "dimdoors:riftDoor" ] },
|
||||
"riftEnd": { "sounds" : [ "dimdoors:riftEnd" ] },
|
||||
"riftStart": { "sounds" : [ "dimdoors:riftStart" ] },
|
||||
"tearing": { "sounds" : [ "dimdoors:tearing"] }
|
||||
}
|
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 4 KiB |
After Width: | Height: | Size: 4 KiB |
After Width: | Height: | Size: 4 KiB |