mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 19:29:31 +00:00
Reformat
This commit is contained in:
1 parent
2eb14c45eb
commit
38cb6bf279
19 files changed
+83
-38
No files matched your search
@@ -21,10 +21,11 @@ import net.minecraft.util.LazyValue;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import vazkii.botania.api.brew.Brew;
|
||||
import vazkii.botania.api.internal.DummyMethodHandler;
|
||||
import vazkii.botania.api.internal.IInternalMethodHandler;
|
||||
@@ -50,7 +51,8 @@ public interface BotaniaAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A unique version number for this version of the API. When anything is added, this number will be incremented
|
||||
* @return A unique version number for this version of the API. When anything is added, this number will be
|
||||
* incremented
|
||||
*/
|
||||
default int apiVersion() {
|
||||
return 0;
|
||||
@@ -79,7 +81,8 @@ public interface BotaniaAPI {
|
||||
/**
|
||||
* Make Botania aware of how to transform between different colors of a block, for use in the paint lens.
|
||||
* This method can be safely called during parallel mod initialization
|
||||
* @param block The block
|
||||
*
|
||||
* @param block The block
|
||||
* @param transformer Function from color to a new block
|
||||
*/
|
||||
default void registerPaintableBlock(IRegistryDelegate<Block> block, Function<DyeColor, Block> transformer) {
|
||||
@@ -119,7 +122,8 @@ public interface BotaniaAPI {
|
||||
return "missingno";
|
||||
}
|
||||
|
||||
@Override public float getToughness() {
|
||||
@Override
|
||||
public float getToughness() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
@@ -151,7 +155,8 @@ public interface BotaniaAPI {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override public Ingredient getRepairMaterial() {
|
||||
@Override
|
||||
public Ingredient getRepairMaterial() {
|
||||
return Ingredient.EMPTY;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -45,8 +46,7 @@ public interface BotaniaAPIClient {
|
||||
* @param islandType The islandtype to register
|
||||
* @param model The model, only {@link ResourceLocation} allowed, no {@link ModelResourceLocation} allowed.
|
||||
*/
|
||||
default void registerIslandTypeModel(IFloatingFlower.IslandType islandType, ResourceLocation model) {
|
||||
}
|
||||
default void registerIslandTypeModel(IFloatingFlower.IslandType islandType, ResourceLocation model) {}
|
||||
|
||||
/**
|
||||
* @return An immutable and live view of the registered island type model map
|
||||
|
||||
@@ -10,7 +10,8 @@ package vazkii.botania.api.imc;
|
||||
|
||||
/**
|
||||
* This class defines the IMC methods accepted by Botania and their expected argument types.
|
||||
* This is just for documentation purposes, IMC is meant to be sent when you don't want to depend on the Botania API classes.
|
||||
* This is just for documentation purposes, IMC is meant to be sent when you don't want to depend on the Botania API
|
||||
* classes.
|
||||
*
|
||||
* @see net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent
|
||||
* @see net.minecraftforge.fml.event.lifecycle.InterModProcessEvent
|
||||
@@ -19,14 +20,16 @@ package vazkii.botania.api.imc;
|
||||
public class IMC {
|
||||
/**
|
||||
* Maps a block tag to its weight in world generation. This is used for the Orechid flower.<br />
|
||||
* The argument should be a {@link com.mojang.datafixers.util.Pair<net.minecraft.util.ResourceLocation, Integer>}, any other types are ignored.<br />
|
||||
* The argument should be a {@link com.mojang.datafixers.util.Pair<net.minecraft.util.ResourceLocation, Integer>},
|
||||
* any other types are ignored.<br />
|
||||
* Check the Botania source to see default values.<br>
|
||||
*/
|
||||
public static final String REGISTER_ORE_WEIGHT = "register_ore_weight";
|
||||
|
||||
/**
|
||||
* Maps a block tag to its weight in nether world generation. This is used for the Orechid Ignem flower.<br />
|
||||
* The argument should be a {@link com.mojang.datafixers.util.Pair<net.minecraft.util.ResourceLocation, Integer>}, any other types are ignored.<br />
|
||||
* The argument should be a {@link com.mojang.datafixers.util.Pair<net.minecraft.util.ResourceLocation, Integer>},
|
||||
* any other types are ignored.<br />
|
||||
* Check the Botania source to see default values.<br>
|
||||
*/
|
||||
public static final String REGISTER_NETHER_ORE_WEIGHT = "register_nether_ore_weight";
|
||||
|
||||
@@ -60,8 +60,7 @@ import java.util.List;
|
||||
* Common superclass of all magical flower TE's
|
||||
*/
|
||||
public class TileEntitySpecialFlower extends TileEntity implements ITickableTileEntity, IWandBindable {
|
||||
@CapabilityInject(IFloatingFlower.class)
|
||||
public static Capability<IFloatingFlower> FLOATING_FLOWER_CAP;
|
||||
@CapabilityInject(IFloatingFlower.class) public static Capability<IFloatingFlower> FLOATING_FLOWER_CAP;
|
||||
public static final ResourceLocation DING_SOUND_EVENT = new ResourceLocation("botania", "ding");
|
||||
public static final int SLOWDOWN_FACTOR_PODZOL = 5;
|
||||
public static final int SLOWDOWN_FACTOR_MYCEL = 10;
|
||||
|
||||
@@ -20,10 +20,12 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
import vazkii.botania.common.network.PacketUpdateItemsRemaining;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public final class ItemsRemainingRenderHandler {
|
||||
@@ -32,8 +34,7 @@ public final class ItemsRemainingRenderHandler {
|
||||
private static final int leaveTicks = 20;
|
||||
|
||||
private static ItemStack stack = ItemStack.EMPTY;
|
||||
@Nullable
|
||||
private static ITextComponent customString;
|
||||
@Nullable private static ITextComponent customString;
|
||||
private static int ticks, count;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
/*
|
||||
* This class is distributed as part of the Botania Mod.
|
||||
* Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.impl;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
|
||||
|
||||
@@ -77,22 +77,22 @@ public class BlockCocoon extends BlockMod {
|
||||
TileCocoon cocoon = (TileCocoon) world.getTileEntity(pos);
|
||||
Item item = stack.getItem();
|
||||
|
||||
if(cocoon != null && (item == Items.EMERALD || item == Items.CHORUS_FRUIT || item == ModItems.lifeEssence)) {
|
||||
if(!world.isRemote) {
|
||||
if(item == Items.EMERALD && cocoon.emeraldsGiven < TileCocoon.MAX_EMERALDS) {
|
||||
if(!creative) {
|
||||
if (cocoon != null && (item == Items.EMERALD || item == Items.CHORUS_FRUIT || item == ModItems.lifeEssence)) {
|
||||
if (!world.isRemote) {
|
||||
if (item == Items.EMERALD && cocoon.emeraldsGiven < TileCocoon.MAX_EMERALDS) {
|
||||
if (!creative) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
cocoon.emeraldsGiven++;
|
||||
((ServerWorld) world).spawnParticle(ParticleTypes.HAPPY_VILLAGER, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.1, 0.05, 0.1, 0.5);
|
||||
} else if(item == Items.CHORUS_FRUIT && cocoon.chorusFruitGiven < TileCocoon.MAX_CHORUS_FRUITS) {
|
||||
if(!creative) {
|
||||
} else if (item == Items.CHORUS_FRUIT && cocoon.chorusFruitGiven < TileCocoon.MAX_CHORUS_FRUITS) {
|
||||
if (!creative) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
cocoon.chorusFruitGiven++;
|
||||
((ServerWorld) world).spawnParticle(ParticleTypes.PORTAL, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, 32, 0, 0, 0, 0.5);
|
||||
} else if (item == ModItems.lifeEssence && !cocoon.gaiaSpiritGiven) {
|
||||
if(!creative) {
|
||||
if (!creative) {
|
||||
stack.shrink(1);
|
||||
}
|
||||
cocoon.forceRare();
|
||||
|
||||
@@ -34,6 +34,7 @@ import vazkii.botania.common.block.decor.BlockFloatingFlower;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -38,6 +38,7 @@ import vazkii.botania.api.wand.IWandable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class TileAnimatedTorch extends TileMod implements ITickableTileEntity {
|
||||
@@ -78,7 +79,7 @@ public class TileAnimatedTorch extends TileMod implements ITickableTileEntity {
|
||||
}
|
||||
|
||||
public void onPlace(@Nullable LivingEntity entity) {
|
||||
if(entity != null) {
|
||||
if (entity != null) {
|
||||
side = Arrays.asList(SIDES).indexOf(entity.getHorizontalFacing().getOpposite());
|
||||
}
|
||||
world.notifyNeighborsOfStateChange(getPos().offset(SIDES[side].getOpposite()), getBlockState().getBlock());
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TileCocoon extends TileMod implements ITickableTileEntity {
|
||||
private static final String TAG_TIME_PASSED = "timePassed";
|
||||
private static final String TAG_EMERALDS_GIVEN = "emeraldsGiven";
|
||||
private static final String TAG_CHORUS_FRUIT_GIVEN = "chorusFruitGiven";
|
||||
private static final String TAG_GAIA_SPIRIT_GIVEN = "gaiaSpiritGiven";
|
||||
private static final String TAG_GAIA_SPIRIT_GIVEN = "gaiaSpiritGiven";
|
||||
|
||||
private static final List<EntityType<? extends MobEntity>> SPECIALS = ImmutableList.of(
|
||||
EntityType.HORSE, EntityType.DONKEY, EntityType.WOLF, EntityType.OCELOT,
|
||||
@@ -80,7 +80,7 @@ public class TileCocoon extends TileMod implements ITickableTileEntity {
|
||||
|
||||
MobEntity entity = null;
|
||||
BlockPos placePos = pos;
|
||||
float rareChance = gaiaSpiritGiven ? 1F : SPECIAL_CHANCE;
|
||||
float rareChance = gaiaSpiritGiven ? 1F : SPECIAL_CHANCE;
|
||||
|
||||
float villagerChance = Math.min(1F, (float) emeraldsGiven / (float) MAX_EMERALDS);
|
||||
float shulkerChance = Math.min(1F, (float) chorusFruitGiven / (float) MAX_CHORUS_FRUITS);
|
||||
@@ -113,7 +113,7 @@ public class TileCocoon extends TileMod implements ITickableTileEntity {
|
||||
entity = AQUATIC.get(world.rand.nextInt(AQUATIC.size())).create(world);
|
||||
}
|
||||
} else {
|
||||
if(Math.random() < rareChance) {
|
||||
if (Math.random() < rareChance) {
|
||||
entity = SPECIALS.get(world.rand.nextInt(SPECIALS.size())).create(world);
|
||||
} else {
|
||||
EntityType<? extends MobEntity> type = NORMALS.get(world.rand.nextInt(NORMALS.size()));
|
||||
|
||||
@@ -35,8 +35,7 @@ import java.lang.invoke.MethodHandle;
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
|
||||
public class ExoflameFurnaceHandler {
|
||||
|
||||
@CapabilityInject(IExoflameHeatable.class)
|
||||
public static Capability<IExoflameHeatable> CAPABILITY;
|
||||
@CapabilityInject(IExoflameHeatable.class) public static Capability<IExoflameHeatable> CAPABILITY;
|
||||
public static final ResourceLocation ID = new ResourceLocation(LibMisc.MOD_ID, "exoflame_heatable");
|
||||
|
||||
private static final MethodHandle CAN_SMELT = LibObfuscation.getMethod(AbstractFurnaceTileEntity.class, "func_214008_b", IRecipe.class);
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.InterModComms;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
@@ -35,7 +35,7 @@ public final class IMCHandler {
|
||||
Object thing = msg.getMessageSupplier().get();
|
||||
if (thing instanceof Pair) {
|
||||
return ((Pair) thing).getFirst() instanceof ResourceLocation
|
||||
&& ((Pair) thing).getSecond() instanceof Integer;
|
||||
&& ((Pair) thing).getSecond() instanceof Integer;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package vazkii.botania.common.core.helper;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementManager;
|
||||
import net.minecraft.advancements.PlayerAdvancements;
|
||||
@@ -127,8 +128,9 @@ public final class PlayerHelper {
|
||||
* This is to ensure that any code in mods' onItemUse that relies on player.getHeldItem(ctx.hand) == ctx.stack
|
||||
* will work as intended.
|
||||
* Properly handles null players, as long as the Item's onItemUse also handles them.
|
||||
*
|
||||
* @return The usage result, as well as a properly offset block position pointing at where the block was placed
|
||||
* (if the item was a BlockItem)
|
||||
* (if the item was a BlockItem)
|
||||
*/
|
||||
public static Pair<ActionResultType, BlockPos> substituteUseTrackPos(ItemUseContext ctx, ItemStack toUse) {
|
||||
ItemStack save = ItemStack.EMPTY;
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* This class is distributed as part of the Botania Mod.
|
||||
* Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.common.impl;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -12,6 +20,7 @@ import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.brew.Brew;
|
||||
import vazkii.botania.api.internal.IInternalMethodHandler;
|
||||
@@ -21,6 +30,7 @@ import vazkii.botania.common.core.handler.PixieHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -29,8 +39,9 @@ import java.util.function.Supplier;
|
||||
|
||||
public class BotaniaAPIImpl implements BotaniaAPI {
|
||||
private static final LazyValue<Rarity> RELIC_RARITY = new LazyValue<>(() -> Rarity.create("RELIC", TextFormatting.GOLD));
|
||||
|
||||
private enum ArmorMaterial implements IArmorMaterial {
|
||||
MANASTEEL("manasteel", 16, new int[]{ 2, 5, 6, 2 }, 18, () -> SoundEvents.ITEM_ARMOR_EQUIP_IRON, () -> ModItems.manaSteel, 0),
|
||||
MANASTEEL("manasteel", 16, new int[] { 2, 5, 6, 2 }, 18, () -> SoundEvents.ITEM_ARMOR_EQUIP_IRON, () -> ModItems.manaSteel, 0),
|
||||
MANAWEAVE("manaweave", 5, new int[] { 1, 2, 2, 1 }, 18, () -> SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, () -> ModItems.manaweaveCloth, 0),
|
||||
ELEMENTIUM("elementium", 18, new int[] { 2, 5, 6, 2 }, 18, () -> SoundEvents.ITEM_ARMOR_EQUIP_IRON, () -> ModItems.elementium, 0),
|
||||
TERRASTEEL("terrasteel", 34, new int[] { 3, 6, 8, 3 }, 26, () -> SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, () -> ModItems.terrasteel, 3);
|
||||
@@ -76,7 +87,8 @@ public class BotaniaAPIImpl implements BotaniaAPI {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override public Ingredient getRepairMaterial() {
|
||||
@Override
|
||||
public Ingredient getRepairMaterial() {
|
||||
return Ingredient.fromItems(repairItem.get());
|
||||
}
|
||||
|
||||
@@ -95,8 +107,7 @@ public class BotaniaAPIImpl implements BotaniaAPI {
|
||||
private enum ItemTier implements IItemTier {
|
||||
MANASTEEL(300, 6.2F, 2, 3, 20, () -> ModItems.manaSteel),
|
||||
ELEMENTIUM(720, 6.2F, 2, 3, 20, () -> ModItems.elementium),
|
||||
TERRASTEEL(2300, 9, 3, 4, 26, () -> ModItems.terrasteel)
|
||||
;
|
||||
TERRASTEEL(2300, 9, 3, 4, 26, () -> ModItems.terrasteel);
|
||||
|
||||
private final int maxUses;
|
||||
private final float efficiency;
|
||||
@@ -196,6 +207,7 @@ public class BotaniaAPIImpl implements BotaniaAPI {
|
||||
}
|
||||
|
||||
private final InternalMethodHandler tmp = new InternalMethodHandler();
|
||||
|
||||
@Override
|
||||
public IInternalMethodHandler internalHandler() {
|
||||
return tmp;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityType;
|
||||
@@ -94,7 +95,7 @@ public class ItemSpawnerMover extends Item {
|
||||
ItemStack useStack = new ItemStack(Blocks.SPAWNER);
|
||||
Pair<ActionResultType, BlockPos> res = PlayerHelper.substituteUseTrackPos(ctx, useStack);
|
||||
|
||||
if(res.getFirst() == ActionResultType.SUCCESS) {
|
||||
if (res.getFirst() == ActionResultType.SUCCESS) {
|
||||
World world = ctx.getWorld();
|
||||
BlockPos pos = res.getSecond();
|
||||
ItemStack mover = ctx.getItem();
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* This class is distributed as part of the Botania Mod.
|
||||
* Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.common.network;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -5,16 +13,17 @@ import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
|
||||
import vazkii.botania.client.core.handler.ItemsRemainingRenderHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class PacketUpdateItemsRemaining {
|
||||
private final ItemStack stack;
|
||||
private final int count;
|
||||
@Nullable
|
||||
private final ITextComponent tooltip;
|
||||
@Nullable private final ITextComponent tooltip;
|
||||
|
||||
public PacketUpdateItemsRemaining(ItemStack stack, int count, @Nullable ITextComponent tooltip) {
|
||||
this.stack = stack;
|
||||
|
||||
Reference in new issue
Block a user