mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-14 01:04:11 +00:00
Fixes CMEs
Fixes Client CME with jetpack Fixes Server CME with chunks
This commit is contained in:
1 parent
e900821bd6
commit
4ebf5ee763
2 files changed
+45
-72
No files matched your search
@@ -27,8 +27,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderTickHandler
|
||||
@@ -106,19 +105,17 @@ public class RenderTickHandler
|
||||
|
||||
synchronized(Mekanism.jetpackOn)
|
||||
{
|
||||
for(String s : Mekanism.jetpackOn)
|
||||
{
|
||||
Set<String> jetpackPlayers = new HashSet<String>(Mekanism.jetpackOn);
|
||||
for (String s : jetpackPlayers) {
|
||||
EntityPlayer p = mc.theWorld.getPlayerEntityByName(s);
|
||||
|
||||
if(p == null)
|
||||
{
|
||||
if (p == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Pos3D playerPos = new Pos3D(p);
|
||||
|
||||
if(p != mc.thePlayer)
|
||||
{
|
||||
if (p != mc.thePlayer) {
|
||||
playerPos.translate(0, 1.7, 0);
|
||||
}
|
||||
|
||||
@@ -173,7 +170,9 @@ public class RenderTickHandler
|
||||
{
|
||||
if(world.getWorldTime() % 4 == 0)
|
||||
{
|
||||
for(String s : Mekanism.gasmaskOn)
|
||||
Set<String> gasmaskPlayers = new HashSet<String>(Mekanism.gasmaskOn);
|
||||
|
||||
for(String s : gasmaskPlayers)
|
||||
{
|
||||
EntityPlayer p = mc.theWorld.getPlayerEntityByName(s);
|
||||
|
||||
@@ -201,50 +200,42 @@ public class RenderTickHandler
|
||||
}
|
||||
}
|
||||
|
||||
if(world.getWorldTime() % 4 == 0)
|
||||
{
|
||||
for(EntityPlayer p : (List<EntityPlayer>)world.playerEntities)
|
||||
{
|
||||
if(!Mekanism.flamethrowerActive.contains(p.getCommandSenderName()) && !p.isSwingInProgress && p.getCurrentEquippedItem() != null && p.getCurrentEquippedItem().getItem() instanceof ItemFlamethrower)
|
||||
{
|
||||
if(((ItemFlamethrower)p.getCurrentEquippedItem().getItem()).getGas(p.getCurrentEquippedItem()) != null)
|
||||
{
|
||||
if(world.getWorldTime() % 4 == 0) {
|
||||
List<EntityPlayer> flamethrowerPlayers = new ArrayList<>((List<EntityPlayer>) world.playerEntities);
|
||||
for (EntityPlayer p : flamethrowerPlayers) {
|
||||
if (!Mekanism.flamethrowerActive.contains(p.getCommandSenderName()) && !p.isSwingInProgress && p.getCurrentEquippedItem() != null && p.getCurrentEquippedItem().getItem() instanceof ItemFlamethrower) {
|
||||
if (((ItemFlamethrower) p.getCurrentEquippedItem().getItem()).getGas(p.getCurrentEquippedItem()) != null) {
|
||||
Pos3D playerPos = new Pos3D(p);
|
||||
Pos3D flameVec = new Pos3D();
|
||||
|
||||
if(p.isSneaking())
|
||||
{
|
||||
|
||||
if (p.isSneaking()) {
|
||||
flameVec.yPos -= 0.35F;
|
||||
flameVec.zPos -= 0.15F;
|
||||
}
|
||||
|
||||
|
||||
Pos3D flameMotion = new Pos3D(p.motionX, p.onGround ? 0 : p.motionY, p.motionZ);
|
||||
|
||||
if(player == p && mc.gameSettings.thirdPersonView == 0)
|
||||
{
|
||||
|
||||
if (player == p && mc.gameSettings.thirdPersonView == 0) {
|
||||
flameVec = new Pos3D(0.8, 0.8, 0.8);
|
||||
|
||||
|
||||
flameVec.multiply(new Pos3D(p.getLook(90)));
|
||||
flameVec.rotateYaw(15);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
flameVec.xPos -= 0.45F;
|
||||
|
||||
if(player == p)
|
||||
{
|
||||
|
||||
if (player == p) {
|
||||
flameVec.yPos -= 0.5F;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
flameVec.yPos += 1F;
|
||||
}
|
||||
|
||||
|
||||
flameVec.zPos += 1.05F;
|
||||
|
||||
|
||||
flameVec.rotateYaw(p.renderYawOffset);
|
||||
}
|
||||
|
||||
|
||||
Pos3D mergedVec = playerPos.clone().translate(flameVec);
|
||||
|
||||
|
||||
spawnAndSetParticle("flame", world, mergedVec.xPos, mergedVec.yPos, mergedVec.zPos, flameMotion.xPos, flameMotion.yPos, flameMotion.zPos);
|
||||
}
|
||||
}
|
||||
@@ -258,17 +249,16 @@ public class RenderTickHandler
|
||||
{
|
||||
EntityFX fx = null;
|
||||
|
||||
if(s.equals("flame"))
|
||||
{
|
||||
fx = new EntityJetpackFlameFX(world, x, y, z, velX, velY, velZ);
|
||||
}
|
||||
else if(s.equals("smoke"))
|
||||
{
|
||||
fx = new EntityJetpackSmokeFX(world, x, y, z, velX, velY, velZ);
|
||||
}
|
||||
else if(s.equals("bubble"))
|
||||
{
|
||||
fx = new EntityScubaBubbleFX(world, x, y, z, velX, velY, velZ);
|
||||
switch (s) {
|
||||
case "flame":
|
||||
fx = new EntityJetpackFlameFX(world, x, y, z, velX, velY, velZ);
|
||||
break;
|
||||
case "smoke":
|
||||
fx = new EntityJetpackSmokeFX(world, x, y, z, velX, velY, velZ);
|
||||
break;
|
||||
case "bubble":
|
||||
fx = new EntityScubaBubbleFX(world, x, y, z, velX, velY, velZ);
|
||||
break;
|
||||
}
|
||||
|
||||
mc.effectRenderer.addEffect(fx);
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
package mekanism.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import mekanism.api.Coord4D;
|
||||
@@ -92,6 +85,7 @@ import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.WorldChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
@@ -1628,24 +1622,13 @@ public class Mekanism
|
||||
{
|
||||
if(event.getChunk() != null && !event.world.isRemote)
|
||||
{
|
||||
//Map copy = (Map)((HashMap)event.getChunk().chunkTileEntityMap).clone();
|
||||
HashMap<ChunkPosition, TileEntity> chunkData = new HashMap<ChunkPosition, TileEntity>(event.getChunk().chunkTileEntityMap);
|
||||
|
||||
for(Iterator iter = /*copy*/event.getChunk().chunkTileEntityMap.values().iterator(); iter.hasNext();)
|
||||
{
|
||||
Object obj = iter.next();
|
||||
|
||||
if(obj instanceof TileEntity)
|
||||
{
|
||||
TileEntity tileEntity = (TileEntity)obj;
|
||||
|
||||
if(tileEntity instanceof TileEntityElectricBlock && MekanismUtils.useIC2())
|
||||
{
|
||||
((TileEntityElectricBlock)tileEntity).register();
|
||||
}
|
||||
else if(tileEntity instanceof IChunkLoadHandler)
|
||||
{
|
||||
((IChunkLoadHandler)tileEntity).onChunkLoad();
|
||||
}
|
||||
for (TileEntity tileEntity : chunkData.values()) {
|
||||
if (tileEntity instanceof TileEntityElectricBlock && MekanismUtils.useIC2()) {
|
||||
((TileEntityElectricBlock) tileEntity).register();
|
||||
} else if (tileEntity instanceof IChunkLoadHandler) {
|
||||
((IChunkLoadHandler) tileEntity).onChunkLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user