Merge branch 'master' into flattening_test

This commit is contained in:
Vincent Lee committed 2017-12-16 12:45:00 -06:00
commit 02fbb7f957
51 files changed
+168 -184

No files matched your search

@@ -21,20 +21,20 @@ public interface IHornHarvestable {
/**
* Returns true if this block can be uprooted.
* Note that the stack param can be null if it's a drum breaking it.
* Note that the stack param can be empty if it's a drum breaking it.
*/
public boolean canHornHarvest(World world, BlockPos pos, ItemStack stack, EnumHornType hornType);
/**
* Returns true if harvestByHorn() should be called. If false it just uses the normal
* block breaking method.
* Note that the stack param can be null if it's a drum breaking it.
* Note that the stack param can be empty if it's a drum breaking it.
*/
public boolean hasSpecialHornHarvest(World world, BlockPos pos, ItemStack stack, EnumHornType hornType);
/**
* Called to harvest by a horn.
* Note that the stack param can be null if it's a drum breaking it.
* Note that the stack param can be empty if it's a drum breaking it.
*/
public void harvestByHorn(World world, BlockPos pos, ItemStack stack, EnumHornType hornType);
@@ -83,7 +83,7 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
}
public String getTagline() {
return null; // Override this if you want a tagline. You probably do
return ""; // Override this if you want a tagline. You probably do
}
@SideOnly(Side.CLIENT)
@@ -26,7 +26,7 @@ public interface ILens extends ILensEffect {
public boolean canCombineLenses(ItemStack sourceLens, ItemStack compositeLens);
/**
* Gets the composite lens in the stack passed in, return null for none.
* Gets the composite lens in the stack passed in, return empty for none.
*/
public ItemStack getCompositeLens(ItemStack stack);
@@ -29,10 +29,11 @@ import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.common.item.ItemAstrolabe;
import vazkii.botania.common.lib.LibMisc;
import java.util.List;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class AstrolabePreviewHandler {
@SubscribeEvent
@@ -33,10 +33,11 @@ import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.entity.EntityMagicLandmine;
import vazkii.botania.common.item.ItemTwigWand;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibMisc;
import java.awt.Color;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class BlockHighlightRenderHandler {
private BlockHighlightRenderHandler() {}
@@ -24,6 +24,7 @@ import vazkii.botania.api.internal.ShaderCallback;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.lib.LibMisc;
import java.awt.Rectangle;
import java.util.Collections;
@@ -31,7 +32,7 @@ import java.util.Set;
import java.util.UUID;
import java.util.WeakHashMap;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class BossBarHandler {
private BossBarHandler() {}
@@ -29,8 +29,9 @@ import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibMisc;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class ClientTickHandler {
private ClientTickHandler() {}
@@ -37,7 +37,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.UUID;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class DebugHandler {
private DebugHandler() {}
@@ -70,6 +70,7 @@ import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.ItemDodgeRing;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.lib.LibObfuscation;
import java.awt.Color;
@@ -77,7 +78,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class HUDHandler {
private HUDHandler() {}
@@ -26,11 +26,12 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.client.fx.FXLightning;
import vazkii.botania.client.fx.ParticleRenderDispatcher;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.lib.LibMisc;
import java.util.ArrayDeque;
import java.util.Deque;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public class LightningHandler {
private LightningHandler() {}
@@ -50,7 +50,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.function.IntFunction;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class ModelHandler {
@SubscribeEvent
public static void registerModels(ModelRegistryEvent evt) {
@@ -40,8 +40,9 @@ import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.lib.LibMisc;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class MultiblockRenderHandler {
private MultiblockRenderHandler() {}
@@ -23,9 +23,10 @@ import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ItemLexicon;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.page.PageText;
import vazkii.botania.common.lib.LibMisc;
// Hacky way to render 3D lexicon, will be reevaluated in the future.
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public class RenderLexicon {
private static final ModelBook model = new ModelBook();
// todo 1.12 improve
@@ -36,10 +36,11 @@ import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ItemLexicon;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
import vazkii.botania.common.lib.LibMisc;
import java.awt.Color;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class TooltipAdditionDisplayHandler {
private static float lexiconLookupTime = 0F;
@@ -18,8 +18,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ItemKeepIvy;
import vazkii.botania.common.lib.LibMisc;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class TooltipHandler {
@SubscribeEvent(priority = EventPriority.HIGHEST)
@@ -140,7 +140,7 @@ public final class RenderHelper {
public static void renderStar(int color, float xScale, float yScale, float zScale, long seed) {
Tessellator tessellator = Tessellator.getInstance();
int ticks = ClientTickHandler.ticksInGame % 200;
float ticks = (ClientTickHandler.ticksInGame % 200) + ClientTickHandler.partialTicks;
if (ticks >= 100)
ticks = 200 - ticks - 1;
@@ -17,9 +17,10 @@ import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.world.WorldTypeSkyblock;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class SkyblockRenderEvents {
@SubscribeEvent
@@ -36,10 +36,11 @@ import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class BlockFelPumpkin extends BlockMod implements ILexiconable {
private static final String TAG_FEL_SPAWNED = "Botania-FelSpawned";
@@ -39,7 +39,7 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class BlockGhostRail extends BlockRailBase implements ILexiconable, IModelRegister {
private static final String TAG_FLOAT_TICKS = "Botania_FloatTicks";
@@ -122,9 +122,10 @@ import vazkii.botania.common.item.block.ItemBlockStorage;
import vazkii.botania.common.item.block.ItemBlockTinyPotato;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.lib.LibOreDict;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public final class ModBlocks {
public static final Block flower = new BlockModFlower();
public static final Block altar = new BlockAltar();
@@ -60,12 +60,13 @@ import vazkii.botania.common.item.block.ItemBlockModSlab;
import vazkii.botania.common.item.block.ItemBlockSpecialQuartz;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public final class ModFluffBlocks {
public static List<Block> slabsToRegister = new ArrayList<>();
@@ -28,11 +28,12 @@ import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.tile.string.TileRedString;
import vazkii.botania.common.block.tile.string.TileRedStringInterceptor;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.Random;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class BlockRedStringInterceptor extends BlockRedString {
public BlockRedStringInterceptor() {
@@ -16,13 +16,14 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.awt.Color;
import java.util.Random;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public class BergamuteEventHandler {
private BergamuteEventHandler() {}
@@ -44,10 +44,13 @@ import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileFunctional;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
import java.util.Collections;
import java.util.List;
import java.util.Random;
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class SubTileLoonuim extends SubTileFunctional {
private static final int COST = 35000;
@@ -70,7 +73,10 @@ public class SubTileLoonuim extends SubTileFunctional {
List<ItemStack> stacks = world.getLootTableManager().getLootTableFromLocation(lootTable).generateLootForPools(rand, new LootContext.Builder((WorldServer) world).build());
if (stacks.isEmpty())
return;
else stack = stacks.get(0);
else {
Collections.shuffle(stacks);
stack = stacks.get(0);
}
} while(stack.isEmpty() || BotaniaAPI.looniumBlacklist.contains(stack.getItem()));
int bound = RANGE * 2 + 1;
@@ -96,18 +102,18 @@ public class SubTileLoonuim extends SubTileFunctional {
else if(world.rand.nextInt(10) == 0) {
entity = new EntityCreeper(world);
if(world.rand.nextInt(200) == 0)
((EntityCreeper) entity).onStruckByLightning(null);
entity.onStruckByLightning(null);
} else
switch(world.rand.nextInt(3)) {
case 0:
entity = new EntityZombie(world);
case 0:
if(world.rand.nextInt(10) == 0)
entity = new EntityHusk(world);
else entity = new EntityZombie(world);
break;
case 1:
entity = new EntitySkeleton(world);
if(world.rand.nextInt(10) == 0)
entity = new EntityStray(world);
else entity = new EntitySkeleton(world);
break;
case 2:
if(world.rand.nextInt(10) == 0)
@@ -132,7 +138,7 @@ public class SubTileLoonuim extends SubTileFunctional {
entity.onInitialSpawn(world.getDifficultyForLocation(pos), null);
world.spawnEntity(entity);
SubTileSpectranthemum.spawnExplosionParticles(entity, 5);
entity.spawnExplosionParticle();
mana -= COST;
sync();
@@ -177,20 +183,14 @@ public class SubTileLoonuim extends SubTileFunctional {
cmp.setString(TAG_LOOT_TABLE, lootTable.toString());
}
@Mod.EventBusSubscriber
public static class DropHandler {
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onDrops(LivingDropsEvent event) {
EntityLivingBase e = event.getEntityLiving();
if(e.getEntityData().hasKey(TAG_ITEMSTACK_TO_DROP)) {
NBTTagCompound cmp = e.getEntityData().getCompoundTag(TAG_ITEMSTACK_TO_DROP);
ItemStack stack = new ItemStack(cmp);
event.getDrops().clear();
event.getDrops().add(new EntityItem(e.world, e.posX, e.posY, e.posZ, stack));
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onDrops(LivingDropsEvent event) {
EntityLivingBase e = event.getEntityLiving();
if(e.getEntityData().hasKey(TAG_ITEMSTACK_TO_DROP)) {
NBTTagCompound cmp = e.getEntityData().getCompoundTag(TAG_ITEMSTACK_TO_DROP);
ItemStack stack = new ItemStack(cmp);
event.getDrops().clear();
event.getDrops().add(new EntityItem(e.world, e.posX, e.posY, e.posZ, stack));
}
}
}
@@ -20,6 +20,7 @@ import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileFunctional;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
import java.util.ArrayList;
import java.util.Collections;
@@ -27,6 +28,7 @@ import java.util.List;
import java.util.Set;
import java.util.WeakHashMap;
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class SubTileVinculotus extends SubTileFunctional {
public static final Set<SubTileVinculotus> existingFlowers = Collections.newSetFromMap(new WeakHashMap<>());
@@ -66,43 +68,37 @@ public class SubTileVinculotus extends SubTileFunctional {
return LexiconData.vinculotus;
}
@Mod.EventBusSubscriber
public static class EndermanIntercepter {
@SubscribeEvent
public static void onEndermanTeleport(EnderTeleportEvent event) {
int cost = 50;
@SubscribeEvent
public static void onEndermanTeleport(EnderTeleportEvent event) {
int cost = 50;
if(event.getEntityLiving() instanceof EntityEnderman) {
List<SubTileVinculotus> possibleFlowers = new ArrayList<>();
for(SubTileVinculotus flower : existingFlowers) {
if(flower.redstoneSignal > 0 || flower.mana <= cost || flower.supertile.getWorld() != event.getEntityLiving().world || flower.supertile.getWorld().getTileEntity(flower.supertile.getPos()) != flower.supertile)
continue;
if(event.getEntityLiving() instanceof EntityEnderman) {
List<SubTileVinculotus> possibleFlowers = new ArrayList<>();
for(SubTileVinculotus flower : existingFlowers) {
if(flower.redstoneSignal > 0 || flower.mana <= cost || flower.supertile.getWorld() != event.getEntityLiving().world || flower.supertile.getWorld().getTileEntity(flower.supertile.getPos()) != flower.supertile)
continue;
double x = flower.supertile.getPos().getX() + 0.5;
double y = flower.supertile.getPos().getY() + 1.5;
double z = flower.supertile.getPos().getZ() + 0.5;
double x = flower.supertile.getPos().getX() + 0.5;
double y = flower.supertile.getPos().getY() + 1.5;
double z = flower.supertile.getPos().getZ() + 0.5;
if(MathHelper.pointDistanceSpace(x, y, z, event.getTargetX(), event.getTargetY(), event.getTargetZ()) < RANGE)
possibleFlowers.add(flower);
}
if(MathHelper.pointDistanceSpace(x, y, z, event.getTargetX(), event.getTargetY(), event.getTargetZ()) < RANGE)
possibleFlowers.add(flower);
}
if(!possibleFlowers.isEmpty()) {
SubTileVinculotus flower = possibleFlowers.get(event.getEntityLiving().world.rand.nextInt(possibleFlowers.size()));
if(!possibleFlowers.isEmpty()) {
SubTileVinculotus flower = possibleFlowers.get(event.getEntityLiving().world.rand.nextInt(possibleFlowers.size()));
double x = flower.supertile.getPos().getX() + 0.5;
double y = flower.supertile.getPos().getY() + 1.5;
double z = flower.supertile.getPos().getZ() + 0.5;
double x = flower.supertile.getPos().getX() + 0.5;
double y = flower.supertile.getPos().getY() + 1.5;
double z = flower.supertile.getPos().getZ() + 0.5;
event.setTargetX(x + Math.random() * 3 - 1);
event.setTargetY(y);
event.setTargetZ(z + Math.random() * 3 - 1);
flower.mana -= cost;
flower.sync();
}
event.setTargetX(x + Math.random() * 3 - 1);
event.setTargetY(y);
event.setTargetZ(z + Math.random() * 3 - 1);
flower.mana -= cost;
flower.sync();
}
}
}
}
@@ -26,9 +26,11 @@ import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
import java.util.List;
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class SubTileNarslimmus extends SubTileGenerating {
public static final String TAG_WORLD_SPAWNED = "Botania:WorldSpawned";
@@ -87,20 +89,15 @@ public class SubTileNarslimmus extends SubTileGenerating {
return LexiconData.narslimmus;
}
@Mod.EventBusSubscriber
public static class SpawnIntercepter {
@SubscribeEvent
public static void onSpawn(LivingSpawnEvent.CheckSpawn event) {
if(event.getEntityLiving() instanceof EntitySlime && event.getResult() != Result.DENY && isSlimeChunk(event.getEntityLiving().world, MathHelper.floor(event.getX()), MathHelper.floor(event.getZ())))
event.getEntityLiving().getEntityData().setBoolean(TAG_WORLD_SPAWNED, true);
}
public static boolean isSlimeChunk(World world, int x, int z) {
Chunk chunk = world.getChunkFromBlockCoords(new BlockPos(x, 0, z));
return chunk.getRandomWithSeed(987234911L).nextInt(10) == 0;
}
@SubscribeEvent
public static void onSpawn(LivingSpawnEvent.CheckSpawn event) {
if(event.getEntityLiving() instanceof EntitySlime && event.getResult() != Result.DENY && isSlimeChunk(event.getEntityLiving().world, MathHelper.floor(event.getX()), MathHelper.floor(event.getZ())))
event.getEntityLiving().getEntityData().setBoolean(TAG_WORLD_SPAWNED, true);
}
public static boolean isSlimeChunk(World world, int x, int z) {
Chunk chunk = world.getChunkFromBlockCoords(new BlockPos(x, 0, z));
return chunk.getRandomWithSeed(987234911L).nextInt(10) == 0;
}
}
@@ -178,7 +178,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
@Override
public void onChunkUnload() {
super.onChunkUnload();
invalidate();
ManaNetworkEvent.removeCollector(this);
}
@Override
@@ -20,8 +20,9 @@ import vazkii.botania.common.brew.potion.PotionClear;
import vazkii.botania.common.brew.potion.PotionEmptiness;
import vazkii.botania.common.brew.potion.PotionFeatherfeet;
import vazkii.botania.common.brew.potion.PotionSoulCross;
import vazkii.botania.common.lib.LibMisc;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class ModPotions {
public static final Potion soulCross = new PotionSoulCross();
@@ -15,8 +15,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.common.lib.LibMisc;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public final class CommonTickHandler {
private CommonTickHandler() {}
@@ -420,7 +420,7 @@ public final class ConfigHandler {
}
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public static class ChangeListener {
@SubscribeEvent
@@ -8,7 +8,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.registries.IForgeRegistry;
import vazkii.botania.common.lib.LibMisc;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public final class ModSounds {
public static final SoundEvent airRod = makeSoundEvent("airrod");
public static final SoundEvent agricarnation = makeSoundEvent("agricarnation");
@@ -17,8 +17,9 @@ import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.entity.EntityPixie;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.armor.elementium.ItemElementiumHelm;
import vazkii.botania.common.lib.LibMisc;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public final class PixieHandler {
private PixieHandler() {}
@@ -25,13 +25,14 @@ import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lexicon.page.PageShedding;
import vazkii.botania.common.lib.LibMisc;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Objects;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public final class SheddingHandler {
private SheddingHandler() {}
@@ -25,7 +25,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.relauncher.Side;
import vazkii.botania.common.lib.LibMisc;
@Mod.EventBusSubscriber(Side.CLIENT)
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public final class VersionChecker {
private VersionChecker() {}
@@ -50,7 +50,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public final class ModCraftingRecipes {
public static ResourceLocation recipeLexicon;
@@ -325,86 +325,26 @@ public final class ModCraftingRecipes {
IForgeRegistry<IRecipe> r = evt.getRegistry();
r.register(new AncientWillRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "ancient_will_attach")));
// RecipeSorter.register("botania:ancientWill", AncientWillRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new BlackHoleTalismanExtractRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "black_hole_talisman_extract")));
// RecipeSorter.register("botania:blackHoleTalismanExtract", BlackHoleTalismanExtractRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new SpellClothRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "cleanse_enchants")));
// RecipeSorter.register("botania:spellCloth", SpellClothRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new CompositeLensRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "composite_lens")));
// RecipeSorter.register("botania:compositeLens", CompositeLensRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new CosmeticAttachRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "cosmetic_attach")));
r.register(new CosmeticRemoveRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "cosmetic_remove")));
// RecipeSorter.register("botania:cosmeticAttach", CosmeticAttachRecipe.class, RecipeSorter.Category.SHAPELESS, "");
// RecipeSorter.register("botania:cosmeticRemove", CosmeticRemoveRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new HelmRevealingRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "helm_revealing")));
// RecipeSorter.register("botania:helmRevealing", HelmRevealingRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new KeepIvyRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "keep_ivy_attach")));
// RecipeSorter.register("botania:keepIvy", KeepIvyRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new LensDyeingRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "lens_dye")));
// RecipeSorter.register("botania:lensDying", LensDyeingRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new ManaGunLensRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "mana_gun_add_lens")));
r.register(new ManaGunRemoveLensRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "mana_gun_remove_lens")));
r.register(new ManaGunClipRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "mana_gun_add_clip")));
// RecipeSorter.register("botania:manaGunLens", ManaGunLensRecipe.class, RecipeSorter.Category.SHAPELESS, "");
// RecipeSorter.register("botania:manaGunRemoveLens", ManaGunRemoveLensRecipe.class, RecipeSorter.Category.SHAPELESS, "");
// RecipeSorter.register("botania:manaGunClip", ManaGunClipRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new PhantomInkRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "phantom_ink")));
// RecipeSorter.register("botania:phantomInk", PhantomInkRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new SpecialFloatingFlowerRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "special_floating_flower")));
// RecipeSorter.register("botania:floatingSpecialFlower", SpecialFloatingFlowerRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new TerraPickTippingRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "terra_pick_tipping")));
// RecipeSorter.register("botania:terraPickTipping", TerraPickTippingRecipe.class, RecipeSorter.Category.SHAPELESS, "");
for(int i = 0; i < 8; i++) {
GameRegistry.addSmelting(new ItemStack(ModFluffBlocks.biomeStoneA, 1, i + 8), new ItemStack(ModFluffBlocks.biomeStoneA, 1, i), 0.1F);
}
/*// Wand of the Forest Recipes
File f = new File("/home/vincent/CS/mods/Botania/eclipse/wands/");
f.mkdirs();
Gson gson =new GsonBuilder().setPrettyPrinting().create();
recipesTwigWand = new ArrayList<>();
for(int i = 0; i < 16; i++)
for(int j = 0; j < 16; j++) {
ItemStack output = ItemTwigWand.forColors(i, j);
Map<String, Object> json = new HashMap<>();
json.put("result", ImmutableMap.of("item", ModItems.twigWand.getRegistryName().toString(), "data", 0, "nbt", output.getTagCompound().toString()));
json.put("group", ModItems.twigWand.getRegistryName().toString());
json.put("type", "forge:ore_shaped");
json.put("pattern", ImmutableList.of(" AS", " SB", "S "));
Map<String, Object> key = new HashMap<>();
key.put("A", ImmutableMap.of("item", "#" + LibOreDict.PETAL[i].toUpperCase()));
key.put("B", ImmutableMap.of("item", "#" + LibOreDict.PETAL[j].toUpperCase()));
key.put("S", ImmutableMap.of("item", "#" + LibOreDict.LIVINGWOOD_TWIG.toUpperCase()));
json.put("key", key);
String name = String.format("%s_%s_%s.json", ModItems.twigWand.getRegistryName().getResourcePath(), EnumDyeColor.byMetadata(i), EnumDyeColor.byMetadata(j));
File f1 = new File(f, name);
try (FileWriter w = new FileWriter(f1)) {
gson.toJson(json, w);
} catch (IOException e) {
e.printStackTrace();
}
*//*recipesTwigWand.add(recipe.getRegistryName());
r.register(recipe);*//*
}*/
// Terrasteel Armor Recipes
// RecipeSorter.register("botania:armorUpgrade", ArmorUpgradeRecipe.class, RecipeSorter.Category.SHAPED, "");
r.register(new ArmorUpgradeRecipe(new ItemStack(ModItems.terrasteelHelmRevealing),
"TRT", "SAS", " S ",
'T', LibOreDict.LIVINGWOOD_TWIG,
@@ -440,13 +380,11 @@ public final class ModCraftingRecipes {
'R', LibOreDict.RUNE[7],
'A', new ItemStack(ModItems.manasteelBoots)).setRegistryName(ModItems.terrasteelBoots.getRegistryName()));
// RecipeSorter.register("botania:manaUpgrade", ManaUpgradeRecipe.class, RecipeSorter.Category.SHAPED, "");
r.register(new ManaUpgradeRecipe(new ItemStack(ModItems.manaRing),
"TI ", "I I", " I ",
'T', new ItemStack(ModItems.manaTablet, 1, Short.MAX_VALUE),
'I', LibOreDict.MANA_STEEL).setRegistryName(ModItems.manaRing.getRegistryName()));
// RecipeSorter.register("botania:manaUpgradeShapeless", ShapelessManaUpgradeRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new ShapelessManaUpgradeRecipe(new ItemStack(ModItems.manaRingGreater), LibOreDict.TERRA_STEEL, new ItemStack(ModItems.manaRing, 1, Short.MAX_VALUE)).setRegistryName(ModItems.manaRingGreater.getRegistryName()));
// Terra Shatterer Recipe
@@ -33,7 +33,7 @@ public class ItemSlimeBottle extends ItemMod {
if(!world.isRemote) {
int x = MathHelper.floor(entity.posX);
int z = MathHelper.floor(entity.posZ);
boolean slime = SubTileNarslimmus.SpawnIntercepter.isSlimeChunk(world, x, z);
boolean slime = SubTileNarslimmus.isSlimeChunk(world, x, z);
int meta = stack.getItemDamage();
int newMeta = slime ? 1 : 0;
if(meta != newMeta)
@@ -93,9 +93,10 @@ import vazkii.botania.common.item.rod.ItemTerraformRod;
import vazkii.botania.common.item.rod.ItemTornadoRod;
import vazkii.botania.common.item.rod.ItemWaterRod;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.lib.LibOreDict;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public final class ModItems {
public static final Item lexicon = new ItemLexicon();
public static final Item petal = new ItemPetal();
@@ -51,7 +51,7 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.List;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class ItemBlockSpecialFlower extends ItemBlockMod implements IRecipeKeyProvider {
public ItemBlockSpecialFlower(Block block1) {
@@ -22,6 +22,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
import net.minecraftforge.fml.relauncher.Side;
@@ -31,26 +32,26 @@ import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.network.PacketDodge;
import vazkii.botania.common.network.PacketHandler;
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
public class ItemDodgeRing extends ItemBauble {
public static final String TAG_DODGE_COOLDOWN = "dodgeCooldown";
public static final int MAX_CD = 20;
int leftDown, rightDown;
private static boolean oldLeftDown, oldRightDown;
private static int leftDown, rightDown;
public ItemDodgeRing() {
super(LibItemNames.DODGE_RING);
if(FMLCommonHandler.instance().getSide().isClient())
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onKeyDown(KeyInputEvent event) {
public static void onKeyDown(KeyInputEvent event) {
Minecraft mc = Minecraft.getMinecraft();
IItemHandler baublesInv = BaublesApi.getBaublesHandler(mc.player);
@@ -65,19 +66,22 @@ public class ItemDodgeRing extends ItemBauble {
return;
int threshold = 4;
if(mc.gameSettings.keyBindLeft.isKeyDown()) {
if(mc.gameSettings.keyBindLeft.isKeyDown() && !oldLeftDown) {
int oldLeft = leftDown;
leftDown = ClientTickHandler.ticksInGame;
if(leftDown - oldLeft < threshold)
dodge(mc.player, true);
} else if(mc.gameSettings.keyBindRight.isKeyDown()) {
} else if(mc.gameSettings.keyBindRight.isKeyDown() && !oldRightDown) {
int oldRight = rightDown;
rightDown = ClientTickHandler.ticksInGame;
if(rightDown - oldRight < threshold)
dodge(mc.player, false);
}
oldLeftDown = mc.gameSettings.keyBindLeft.isKeyDown();
oldRightDown = mc.gameSettings.keyBindRight.isKeyDown();
}
@Override
@@ -87,8 +91,7 @@ public class ItemDodgeRing extends ItemBauble {
ItemNBTHelper.setInt(stack, TAG_DODGE_COOLDOWN, cd - 1);
}
@SideOnly(Side.CLIENT)
public void dodge(EntityPlayer player, boolean left) {
private static void dodge(EntityPlayer player, boolean left) {
if(player.capabilities.isFlying || !player.onGround || player.moveForward > 0.2 || player.moveForward < -0.2)
return;
@@ -107,8 +110,6 @@ public class ItemDodgeRing extends ItemBauble {
@SideOnly(Side.CLIENT)
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack stack, float pticks) {
Math.max(1, stack.getItemDamage());
Minecraft.getMinecraft();
int xo = resolution.getScaledWidth() / 2 - 20;
int y = resolution.getScaledHeight() / 2 + 20;
@@ -30,10 +30,11 @@ import vazkii.botania.api.item.IBaubleRender;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
import java.util.List;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class ItemGoddessCharm extends ItemBauble implements IManaUsingItem, IBaubleRender {
public static final int COST = 1000;
@@ -91,7 +91,7 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
if(player.isSneaking())
player.stepHeight = 0.60001F; // Not 0.6F because that is the default
else player.stepHeight = 1F;
else player.stepHeight = 1.25F;
} else {
player.stepHeight = 0.6F;
@@ -99,7 +99,7 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
}
} else if(shouldPlayerHaveStepup(player)) {
playersWithStepup.add(s);
player.stepHeight = 1F;
player.stepHeight = 1.25F;
}
}
}
@@ -50,7 +50,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinateListProvider, IManaUsingItem {
private static final String TAG_CURSOR_LIST = "cursorList";
@@ -34,7 +34,7 @@ import vazkii.botania.common.lib.LibMisc;
import java.util.ArrayList;
import java.util.List;
@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class ItemOdinRing extends ItemRelicBauble {
private static final List<String> damageNegations = new ArrayList<>();