mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 19:05:16 +00:00
Merge branch 'master' of https://github.com/Vazkii/Botania
This commit is contained in:
commit
2bed6568fe
12 files changed
+84
-47
No files matched your search
@@ -64,3 +64,10 @@ saintsquiggle=0
|
||||
cadevsgaming=5
|
||||
golemofstone=0
|
||||
yoloherobrine=6
|
||||
mstiles92=2
|
||||
ninjax11=0
|
||||
modapi=0
|
||||
spectacular101=0
|
||||
tamaized=6
|
||||
lerazzer=10
|
||||
akirakujo=5
|
||||
@@ -31,8 +31,10 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -103,7 +105,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
TileEntity te = worldIn.getTileEntity(pos);
|
||||
TileEntity te = worldIn instanceof ChunkCache ? ((ChunkCache)worldIn).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : worldIn.getTileEntity(pos);
|
||||
if (te instanceof TileAltar) {
|
||||
TileAltar altar = (TileAltar) te;
|
||||
|
||||
|
||||
@@ -31,8 +31,10 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
@@ -75,7 +77,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
@Override
|
||||
public IBlockState getExtendedState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
state = super.getExtendedState(state, world, pos);
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TileFloatingSpecialFlower) {
|
||||
state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.SUBTILE_ID, ((TileFloatingSpecialFlower) te).subTileName);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -88,8 +90,9 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
if (world.getTileEntity(pos) instanceof TileCraftCrate) {
|
||||
TileCraftCrate tile = (TileCraftCrate) world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TileCraftCrate) {
|
||||
TileCraftCrate tile = (TileCraftCrate) te;
|
||||
state = state.withProperty(BotaniaStateProps.CRATE_PATTERN, CratePattern.values()[tile.pattern + 1]);
|
||||
} else {
|
||||
state = state.withProperty(BotaniaStateProps.CRATE_PATTERN, CratePattern.NONE);
|
||||
|
||||
@@ -30,9 +30,11 @@ import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
@@ -95,8 +97,9 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
|
||||
state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.HELD_WORLD, world)
|
||||
.withProperty(BotaniaStateProps.HELD_POS, pos);
|
||||
|
||||
if (world.getTileEntity(pos) instanceof TileCamo) {
|
||||
TileCamo tile = (TileCamo) world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TileCamo) {
|
||||
TileCamo tile = (TileCamo) te;
|
||||
return ((IExtendedBlockState) state).withProperty(BotaniaStateProps.HELD_STATE, tile.camoState);
|
||||
} else {
|
||||
return state;
|
||||
|
||||
@@ -39,8 +39,10 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
@@ -145,7 +147,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
@Nonnull
|
||||
@Override
|
||||
public IExtendedBlockState getExtendedState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TileSpecialFlower && ((TileSpecialFlower) te).getSubTile() != null) {
|
||||
Class<? extends SubTileEntity> clazz = ((TileSpecialFlower) te).getSubTile().getClass();
|
||||
String id = BotaniaAPI.getSubTileStringMapping(clazz);
|
||||
|
||||
@@ -34,8 +34,10 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
@@ -125,7 +127,7 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
|
||||
@Override
|
||||
public IBlockState getExtendedState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
state = getActualState(state, world, pos);
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TileFloatingFlower) {
|
||||
state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.ISLAND_TYPE, ((TileFloatingFlower) te).getIslandType());
|
||||
} else if (te instanceof TileFloatingSpecialFlower) {
|
||||
|
||||
@@ -36,8 +36,10 @@ import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -103,7 +105,7 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TilePool) {
|
||||
return state.withProperty(BotaniaStateProps.COLOR, ((TilePool) te).color);
|
||||
} else {
|
||||
|
||||
+3
-1
@@ -19,6 +19,7 @@ import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -44,9 +45,10 @@ public class SubTileGourmaryllis extends SubTileGenerating {
|
||||
|
||||
if(cooldown > -1)
|
||||
cooldown--;
|
||||
if(cooldown == 0) {
|
||||
if(cooldown == 0 && storedMana != 0) {
|
||||
mana = Math.min(getMaxMana(), mana + storedMana);
|
||||
storedMana = 0;
|
||||
getWorld().playSound(null, supertile.getPos(), SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.BLOCKS, 1, 1);
|
||||
sync();
|
||||
}
|
||||
|
||||
|
||||
@@ -104,10 +104,11 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver {
|
||||
EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null;
|
||||
entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F);
|
||||
|
||||
if (entityliving == null || entityliving.getCanSpawnHere())
|
||||
if (entityliving == null || net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(entityliving, logic.getSpawnerWorld(), (float)entity.posX, (float)entity.posY, (float)entity.posZ))
|
||||
{
|
||||
if (randomEntity.getNbt().getSize() == 1 && randomEntity.getNbt().hasKey("id", 8) && entity instanceof EntityLiving)
|
||||
{
|
||||
if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, logic.getSpawnerWorld(), (float)entity.posX, (float)entity.posY, (float)entity.posZ))
|
||||
((EntityLiving)entity).onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entity)), null);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.network.PacketBotaniaEffect;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
|
||||
public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
|
||||
@@ -71,6 +73,9 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if(world.isRemote)
|
||||
return;
|
||||
|
||||
boolean removeMana = true;
|
||||
|
||||
if(hasValidPlatform()) {
|
||||
@@ -88,10 +93,13 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
otherSpark.registerTransfer(spark);
|
||||
}
|
||||
}
|
||||
if(mana > 0)
|
||||
doParticles();
|
||||
if(mana > 0) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
|
||||
PacketHandler.sendToNearby(world, getPos(),
|
||||
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.TERRA_PLATE, getPos().getX(), getPos().getY(), getPos().getZ()));
|
||||
}
|
||||
|
||||
if(mana >= MAX_MANA && !worldObj.isRemote) {
|
||||
if(mana >= MAX_MANA) {
|
||||
EntityItem item = items.get(0);
|
||||
for(EntityItem otherItem : items)
|
||||
if(otherItem != item)
|
||||
@@ -109,38 +117,6 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
recieveMana(-1000);
|
||||
}
|
||||
|
||||
void doParticles() {
|
||||
if(worldObj.isRemote) {
|
||||
int ticks = (int) (100.0 * ((double) getCurrentMana() / (double) MAX_MANA));
|
||||
|
||||
int totalSpiritCount = 3;
|
||||
double tickIncrement = 360D / totalSpiritCount;
|
||||
|
||||
int speed = 5;
|
||||
double wticks = ticks * speed - tickIncrement;
|
||||
|
||||
double r = Math.sin((ticks - 100) / 10D) * 2;
|
||||
double g = Math.sin(wticks * Math.PI / 180 * 0.55);
|
||||
|
||||
for(int i = 0; i < totalSpiritCount; i++) {
|
||||
double x = pos.getX() + Math.sin(wticks * Math.PI / 180) * r + 0.5;
|
||||
double y = pos.getY() + 0.25 + Math.abs(r) * 0.7;
|
||||
double z = pos.getZ() + Math.cos(wticks * Math.PI / 180) * r + 0.5;
|
||||
|
||||
wticks += tickIncrement;
|
||||
float[] colorsfx = new float[] {
|
||||
0F, (float) ticks / (float) 100, 1F - (float) ticks / (float) 100
|
||||
};
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F);
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F);
|
||||
|
||||
if(ticks == 100)
|
||||
for(int j = 0; j < 15; j++)
|
||||
Botania.proxy.wispFX(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityItem> getItems() {
|
||||
return worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -15,6 +16,7 @@ import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.TileTerraPlate;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
@@ -240,6 +242,38 @@ public class PacketBotaniaEffect implements IMessage {
|
||||
|
||||
break;
|
||||
}
|
||||
case TERRA_PLATE: {
|
||||
TileEntity te = world.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||
if(te instanceof TileTerraPlate) {
|
||||
int ticks = (int) (100.0 * ((double) ((TileTerraPlate) te).getCurrentMana() / (double) TileTerraPlate.MAX_MANA));
|
||||
|
||||
int totalSpiritCount = 3;
|
||||
double tickIncrement = 360D / totalSpiritCount;
|
||||
|
||||
int speed = 5;
|
||||
double wticks = ticks * speed - tickIncrement;
|
||||
|
||||
double r = Math.sin((ticks - 100) / 10D) * 2;
|
||||
double g = Math.sin(wticks * Math.PI / 180 * 0.55);
|
||||
|
||||
for(int i = 0; i < totalSpiritCount; i++) {
|
||||
double x = message.x + Math.sin(wticks * Math.PI / 180) * r + 0.5;
|
||||
double y = message.y + 0.25 + Math.abs(r) * 0.7;
|
||||
double z = message.z + Math.cos(wticks * Math.PI / 180) * r + 0.5;
|
||||
|
||||
wticks += tickIncrement;
|
||||
float[] colorsfx = new float[] {
|
||||
0F, (float) ticks / (float) 100, 1F - (float) ticks / (float) 100
|
||||
};
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F);
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F);
|
||||
|
||||
if(ticks == 100)
|
||||
for(int j = 0; j < 15; j++)
|
||||
Botania.proxy.wispFX(message.x + 0.5, message.y + 0.5, message.z + 0.5, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -259,7 +293,8 @@ public class PacketBotaniaEffect implements IMessage {
|
||||
ENCHANTER_CRAFT(0),
|
||||
ENCHANTER_DESTROY(0),
|
||||
ENTROPINNYUM(0),
|
||||
BLACK_LOTUS_DISSOLVE(0);
|
||||
BLACK_LOTUS_DISSOLVE(0),
|
||||
TERRA_PLATE(0);
|
||||
|
||||
private final int argCount;
|
||||
|
||||
|
||||
Reference in new issue
Block a user