mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 14:24:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0642754886 | ||
|
|
2d225337af | ||
|
|
9f66216832 | ||
|
|
ed1cbbe9dd | ||
|
|
6db2aa7dee | ||
|
|
4ce5b40ebb | ||
|
|
c969ea3f72 | ||
|
|
90085c4379 | ||
|
|
14851e751d | ||
|
|
c3da70b52e | ||
|
|
29868d7d8e | ||
|
|
656c0de2a3 | ||
|
|
b777e5856e | ||
|
|
f3dea919a6 | ||
|
|
af9588ff11 | ||
|
|
8d52bb686f | ||
|
|
d4d42208a2 | ||
|
|
fb34e7e848 | ||
|
|
53a582e188 | ||
|
|
bffa5a1171 | ||
|
|
a47619879a | ||
|
|
6545845850 | ||
|
|
8809524d6d | ||
|
|
a9062856d1 | ||
|
|
ddcff076a7 | ||
|
|
9e56e04e6c | ||
|
|
b91ab69cea | ||
|
|
d12717c29f | ||
|
|
808d80affa | ||
|
|
6478eb907e | ||
|
|
334d910086 | ||
|
|
1b97974d0e | ||
|
|
2fe7d5e025 | ||
|
|
360a398fca | ||
|
|
a9171cd215 | ||
|
|
815cdc9f52 | ||
|
|
0a235cf5e8 | ||
|
|
25a4877e1a | ||
|
|
28febcac08 | ||
|
|
757abbe6d7 | ||
|
|
28aa8bc0d5 | ||
|
|
5392f00ff9 | ||
|
|
64712d315f | ||
|
|
789832bdc1 | ||
|
|
a0a7428116 | ||
|
|
37eb1a781c | ||
|
|
a0a78ea203 | ||
|
|
ba3f337520 | ||
|
|
9e13eda148 | ||
|
|
4f26ea9893 | ||
|
|
878c0dbeba | ||
|
|
687d475aeb | ||
|
|
1eafb2e85e | ||
|
|
2877d304ce | ||
|
|
dc1eab4dd8 | ||
|
|
f71b4b6cf2 | ||
|
|
2b3cfd985c | ||
|
|
2a4b489eca | ||
|
|
348b52eb9f | ||
|
|
12be321b73 | ||
|
|
07f68b37da | ||
|
|
8d9996cb6b | ||
|
|
32a28e83a5 | ||
|
|
0b34fe7193 | ||
|
|
a3e8d88f1c | ||
|
|
8423607b29 | ||
|
|
90c42b25c7 | ||
|
|
ddda9db4ac | ||
|
|
16615ce429 | ||
|
|
aeaa2a76c4 | ||
|
|
921825aca3 | ||
|
|
c3e4a02825 | ||
|
|
3d7c9e8b94 | ||
|
|
a0aac5a9bf | ||
|
|
acd5cce7ce | ||
|
|
8eccfad65e | ||
|
|
59771083d2 | ||
|
|
3a5e78a4c6 | ||
|
|
b648c36111 | ||
|
|
5e8eaf8c77 | ||
|
|
6cde8299c4 | ||
|
|
947a225d23 | ||
|
|
67ef25de09 | ||
|
|
4656680250 | ||
|
|
072e3a693b | ||
|
|
b29c810a80 | ||
|
|
3f8e3f72d9 | ||
|
|
5041e23ede | ||
|
|
21a35c9c92 | ||
|
|
6d542dec5a | ||
|
|
4552a451ae | ||
|
|
5c33e95a54 | ||
|
|
1e2bd1d4cd | ||
|
|
1cc995c986 | ||
|
|
1799380064 | ||
|
|
0d3ffa2598 | ||
|
|
f8abe9d7b1 | ||
|
|
3dc65c80d8 | ||
|
|
bc0da61058 | ||
|
|
c9e1647070 | ||
|
|
d622f0cd58 | ||
|
|
32a505a575 | ||
|
|
7ce589c6db | ||
|
|
f0aa44999f | ||
|
|
88f99a636c | ||
|
|
568139fd17 | ||
|
|
cf0189c3ee | ||
|
|
2ee0d7f0ed | ||
|
|
6997a96460 | ||
|
|
179ca23f6c | ||
|
|
e7e5b1b484 | ||
|
|
fbd9917fd4 | ||
|
|
881e271a0b | ||
|
|
3b5c500bc9 | ||
|
|
4751da9e7b | ||
|
|
1c4ae58377 | ||
|
|
9f0c710479 | ||
|
|
8a13a03016 | ||
|
|
7ef27df0bc | ||
|
|
01a913c96c | ||
|
|
110396f39e | ||
|
|
233bc705b0 | ||
|
|
6264ebddbc | ||
|
|
bedbf55b33 | ||
|
|
a5d688883e | ||
|
|
83d0b8dc12 | ||
|
|
c05c1ef8bf | ||
|
|
c5d5e59b96 | ||
|
|
1fd48994d7 | ||
|
|
cf56634a91 | ||
|
|
1344bb8c08 | ||
|
|
2bf69eaa56 | ||
|
|
b242d43861 | ||
|
|
404c39c8f8 | ||
|
|
d8bdb6a31d | ||
|
|
c5208175d7 | ||
|
|
a0d0fefe8d | ||
|
|
87172ea3f2 |
No files matched your search
+3
-10
@@ -46,7 +46,7 @@ minecraft {
|
||||
version = "${config.mc_version}-${config.forge_version}"
|
||||
runDir = "eclipse/assets"
|
||||
|
||||
mappings = "snapshot_20160518"
|
||||
mappings = "snapshot_20160718"
|
||||
//This, does the token replacement.
|
||||
//Though, I reccomend this to be replaced with a token such as @VERSION@
|
||||
replace 'GRADLE:BUILD', config.build_number
|
||||
@@ -67,7 +67,7 @@ dependencies {
|
||||
compile files(
|
||||
'Baubles-deobf.jar'
|
||||
)
|
||||
deobfCompile "mezz.jei:jei_1.9.4:3.6.7.216"
|
||||
deobfCompile "mezz.jei:jei_1.10.2:3.7.8.234"
|
||||
|
||||
//and a bit more for SCP
|
||||
sshAntTask "org.apache.ant:ant-jsch:1.7.1", "jsch:jsch:0.1.29"
|
||||
@@ -119,9 +119,7 @@ task incrementBuildNumber(dependsOn: 'reobfJar') << {
|
||||
// todo make this flexibile - collection of supported mc versions
|
||||
|
||||
file('web/versions.ini').append("\n${version}=${minecraft.version}")
|
||||
file('web/versions.ini').append("\n${version}=1.10.2")
|
||||
file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
|
||||
file("${config.dir_repo}/version/1.10.2.txt").write("${version}")
|
||||
|
||||
def updateJsonFile = file('version/update.json')
|
||||
def updateJson = new JsonSlurper().parse(updateJsonFile) as Map
|
||||
@@ -130,14 +128,10 @@ task incrementBuildNumber(dependsOn: 'reobfJar') << {
|
||||
|
||||
// Add to version section
|
||||
updateJson."${minecraft.version}"."${version}" = "See https://github.com/williewillus/Botania/releases/${version}"
|
||||
updateJson."1.10.2"."${version}" = "See https://github.com/williewillus/Botania/releases/${version}"
|
||||
|
||||
// Update promos
|
||||
updateJson.promos."${minecraft.version}-latest" = "${version}"
|
||||
updateJson.promos."${minecraft.version}-recommended" = "${version}"
|
||||
updateJson.promos."1.10.2-latest" = "${version}"
|
||||
updateJson.promos."1.10.2-recommended" = "${version}"
|
||||
|
||||
|
||||
updateJsonFile.write(JsonOutput.prettyPrint(JsonOutput.toJson(updateJson)))
|
||||
}
|
||||
@@ -247,8 +241,7 @@ curseforge {
|
||||
See https://github.com/williewillus/Botania/releases/tag/${version}
|
||||
"""
|
||||
releaseType = "release"
|
||||
addGameVersion '1.9.4'
|
||||
addGameVersion '1.10.2'
|
||||
addGameVersion "${minecraft.version}"
|
||||
relations {
|
||||
requiredLibrary 'baubles'
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#
|
||||
#Wed Jun 29 20:26:39 CDT 2016
|
||||
#Sat Aug 27 12:56:20 CDT 2016
|
||||
version=r1.8
|
||||
dir_output=../Build Output/Botania/
|
||||
forge_version=12.17.0.1965
|
||||
mc_version=1.9.4
|
||||
dir_repo=./
|
||||
build_number=313
|
||||
mc_version=1.10.2
|
||||
forge_version=12.18.1.2056
|
||||
build_number=320
|
||||
mod_name=Botania
|
||||
@@ -6,7 +6,7 @@ import java.util.Map;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTBase.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
@@ -495,16 +495,26 @@ public final class BotaniaAPI {
|
||||
|
||||
/**
|
||||
* Registers a Elven Trade recipe (throw an item in an Alfheim Portal).
|
||||
* @param output The ItemStack to return.
|
||||
* @param outputs The ItemStacks to return.
|
||||
* @param inputs The items required, can be ItemStack or ore dictionary entry string.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
|
||||
RecipeElvenTrade recipe = new RecipeElvenTrade(output, inputs);
|
||||
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack[] outputs, Object... inputs) {
|
||||
RecipeElvenTrade recipe = new RecipeElvenTrade(outputs, inputs);
|
||||
elvenTradeRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Elven Trade recipe (throw an item into an Alfeim Portal).
|
||||
* @param output The ItemStack to return
|
||||
* @param inputs The items required, can be an ItemStack or an Ore Dictionary entry string.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
|
||||
return registerElvenTradeRecipe(new ItemStack[]{ output }, inputs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Brew Recipe (for the Botanical Brewery).
|
||||
* @param brew The brew in to be set in this recipe.
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
@@ -21,23 +22,8 @@ import net.minecraft.world.WorldServer;
|
||||
public final class VanillaPacketDispatcher {
|
||||
|
||||
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
|
||||
if(tile.getWorld() instanceof WorldServer) {
|
||||
WorldServer ws = ((WorldServer) tile.getWorld());
|
||||
SPacketUpdateTileEntity packet = tile.getUpdatePacket();
|
||||
|
||||
if(packet == null)
|
||||
return;
|
||||
|
||||
for (EntityPlayer player : ws.playerEntities) {
|
||||
EntityPlayerMP playerMP = ((EntityPlayerMP) player);
|
||||
|
||||
if (playerMP.getDistanceSq(tile.getPos()) < 64 * 64
|
||||
&& ws.getPlayerChunkMap().isPlayerWatchingChunk(playerMP, tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4)) {
|
||||
playerMP.connection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||
tile.getWorld().notifyBlockUpdate(tile.getPos(), state, state, 8);
|
||||
}
|
||||
|
||||
public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* This class was created by <Flaxbeard>. It's 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
|
||||
*
|
||||
* File Created @ [Jul 25, 2016, 9:02:12 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public class ManaDiscountEvent extends Event {
|
||||
|
||||
private final EntityPlayer entityPlayer;
|
||||
private float discount;
|
||||
|
||||
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount) {
|
||||
this.entityPlayer = entityPlayer;
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public EntityPlayer getEntityPlayer() {
|
||||
return entityPlayer;
|
||||
}
|
||||
|
||||
public float getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
public void setDiscount(float discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.api.mana;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public final class ManaItemHandler {
|
||||
@@ -249,6 +250,10 @@ public final class ManaItemHandler {
|
||||
if(armor != null && armor.getItem() instanceof IManaDiscountArmor)
|
||||
discount += ((IManaDiscountArmor) armor.getItem()).getDiscount(armor, i, player);
|
||||
}
|
||||
|
||||
ManaDiscountEvent event = new ManaDiscountEvent(player, discount);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
discount = event.getDiscount();
|
||||
|
||||
return discount;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ import java.util.List;
|
||||
|
||||
public class RecipeElvenTrade {
|
||||
|
||||
private final ItemStack output;
|
||||
private final ImmutableList<ItemStack> outputs;
|
||||
private final ImmutableList<Object> inputs;
|
||||
|
||||
public RecipeElvenTrade(ItemStack output, Object... inputs) {
|
||||
this.output = output;
|
||||
public RecipeElvenTrade(ItemStack[] outputs, Object... inputs) {
|
||||
this.outputs = ImmutableList.copyOf(outputs);
|
||||
|
||||
ImmutableList.Builder<Object> inputsToSet = ImmutableList.builder();
|
||||
for(Object obj : inputs) {
|
||||
@@ -88,8 +88,8 @@ public class RecipeElvenTrade {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
public List<ItemStack> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,14 +30,11 @@ import vazkii.botania.api.state.enums.CratePattern;
|
||||
import vazkii.botania.api.state.enums.CrateVariant;
|
||||
import vazkii.botania.api.state.enums.CustomBrickVariant;
|
||||
import vazkii.botania.api.state.enums.DrumVariant;
|
||||
import vazkii.botania.api.state.enums.EndBrickVariant;
|
||||
import vazkii.botania.api.state.enums.FutureStoneVariant;
|
||||
import vazkii.botania.api.state.enums.LivingRockVariant;
|
||||
import vazkii.botania.api.state.enums.LivingWoodVariant;
|
||||
import vazkii.botania.api.state.enums.LuminizerVariant;
|
||||
import vazkii.botania.api.state.enums.PlatformVariant;
|
||||
import vazkii.botania.api.state.enums.PoolVariant;
|
||||
import vazkii.botania.api.state.enums.PrismarineVariant;
|
||||
import vazkii.botania.api.state.enums.PylonVariant;
|
||||
import vazkii.botania.api.state.enums.QuartzVariant;
|
||||
import vazkii.botania.api.state.enums.SpreaderVariant;
|
||||
@@ -90,18 +87,6 @@ public final class BotaniaStateProps {
|
||||
|
||||
/** Properties for individual blocks **/
|
||||
|
||||
// Block18Stone
|
||||
public static final PropertyEnum<FutureStoneVariant> FUTURESTONE_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class);
|
||||
|
||||
// Block18StoneWall
|
||||
public static final PropertyEnum<FutureStoneVariant> FUTURESTONEWALL_VARIANT = PropertyEnum.create("fswall_variant", FutureStoneVariant.class, new Predicate<FutureStoneVariant>() {
|
||||
@Override
|
||||
public boolean apply(FutureStoneVariant variant) {
|
||||
// Just the four kinds (no polished, chiseled, etc.)
|
||||
return variant.ordinal() >= 0 && variant.ordinal() <= 3;
|
||||
}
|
||||
});
|
||||
|
||||
// BlockAlfPortal
|
||||
public static final PropertyEnum<AlfPortalState> ALFPORTAL_STATE = PropertyEnum.create("state", AlfPortalState.class);
|
||||
|
||||
@@ -134,9 +119,6 @@ public final class BotaniaStateProps {
|
||||
// BlockEnchanter
|
||||
public static final PropertyEnum<EnumFacing.Axis> ENCHANTER_DIRECTION = PropertyEnum.create("facing", EnumFacing.Axis.class, Predicates.not(Predicates.equalTo(EnumFacing.Axis.Y)));
|
||||
|
||||
// BlockEndStoneBrick
|
||||
public static final PropertyEnum<EndBrickVariant> ENDBRICK_VARIANT = PropertyEnum.create("variant", EndBrickVariant.class);
|
||||
|
||||
// BlockForestDrum
|
||||
public static final PropertyEnum<DrumVariant> DRUM_VARIANT = PropertyEnum.create("variant", DrumVariant.class);
|
||||
|
||||
@@ -188,9 +170,6 @@ public final class BotaniaStateProps {
|
||||
// BlockPrism
|
||||
public static final PropertyBool HAS_LENS = PropertyBool.create("has_lens");
|
||||
|
||||
// BlockPrismarine
|
||||
public static final PropertyEnum<PrismarineVariant> PRISMARINE_VARIANT = PropertyEnum.create("variant", PrismarineVariant.class);
|
||||
|
||||
// BlockPylon
|
||||
public static final PropertyEnum<PylonVariant> PYLON_VARIANT = PropertyEnum.create("variant", PylonVariant.class);
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.api.state.enums;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EndBrickVariant implements IStringSerializable {
|
||||
END_STONE_BRICKS,
|
||||
CHISELED_END_STONE_BRICKS,
|
||||
ENDER_BRICKS,
|
||||
PILLAR_ENDER_BRICKS;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.api.state.enums;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum FutureStoneVariant implements IStringSerializable {
|
||||
ANDESITE,
|
||||
BASALT,
|
||||
DIORITE,
|
||||
GRANITE,
|
||||
POLISHED_ANDESITE,
|
||||
POLISHED_BASALT,
|
||||
POLISHED_DIORITE,
|
||||
POLISHED_GRANITE,
|
||||
ANDESITE_BRICK,
|
||||
BASALT_BRICK,
|
||||
DIORITE_BRICK,
|
||||
GRANITE_BRICK,
|
||||
CHISELED_ANDESITE,
|
||||
CHISELED_BASALT,
|
||||
CHISELED_DIORITE,
|
||||
CHISELED_GRANITE;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.api.state.enums;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum PrismarineVariant implements IStringSerializable {
|
||||
PRISMARINE,
|
||||
PRISMARINE_BRICKS,
|
||||
DARK_PRISMARINE;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Any block that implements this has a HUD rendered when being hovered
|
||||
@@ -21,6 +23,7 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public interface IWandHUD {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos);
|
||||
|
||||
}
|
||||
@@ -31,13 +31,15 @@ import java.util.WeakHashMap;
|
||||
|
||||
public final class BossBarHandler {
|
||||
|
||||
private BossBarHandler() {}
|
||||
|
||||
// Only access on the client thread!
|
||||
public static final Set<IBotaniaBoss> bosses = Collections.newSetFromMap(new WeakHashMap<>());
|
||||
public static final ResourceLocation defaultBossBar = new ResourceLocation(LibResources.GUI_BOSS_BAR);
|
||||
private static final BarCallback barUniformCallback = new BarCallback();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBarRender(RenderGameOverlayEvent.BossInfo evt) {
|
||||
public static void onBarRender(RenderGameOverlayEvent.BossInfo evt) {
|
||||
UUID infoUuid = evt.getBossInfo().getUniqueId();
|
||||
for(IBotaniaBoss currentBoss : bosses) {
|
||||
if(currentBoss.getBossInfoUuid().equals(infoUuid)) {
|
||||
|
||||
@@ -39,8 +39,10 @@ import java.util.List;
|
||||
|
||||
public final class BoundTileRenderer {
|
||||
|
||||
private BoundTileRenderer() {}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableDepth();
|
||||
@@ -89,11 +91,11 @@ public final class BoundTileRenderer {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void renderBlockOutlineAt(BlockPos pos, int color) {
|
||||
private static void renderBlockOutlineAt(BlockPos pos, int color) {
|
||||
renderBlockOutlineAt(pos, color, 1F);
|
||||
}
|
||||
|
||||
private void renderBlockOutlineAt(BlockPos pos, int color, float thickness) {
|
||||
private static void renderBlockOutlineAt(BlockPos pos, int color, float thickness) {
|
||||
double renderPosX, renderPosY, renderPosZ;
|
||||
|
||||
try {
|
||||
@@ -140,7 +142,7 @@ public final class BoundTileRenderer {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void renderBlockOutline(AxisAlignedBB aabb) {
|
||||
private static void renderBlockOutline(AxisAlignedBB aabb) {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
|
||||
double ix = aabb.minX;
|
||||
|
||||
@@ -15,11 +15,7 @@ import java.lang.reflect.Method;
|
||||
public final class ClientMethodHandles {
|
||||
|
||||
public static final MethodHandle
|
||||
renderPosX_getter, renderPosY_getter, renderPosZ_getter, // RenderManager
|
||||
farPlaneDistance_getter,
|
||||
hurtCameraEffect, setupViewBobbing, getFOVModifier,
|
||||
enableLightmap, disableLightmap; // EntityRenderer
|
||||
//prevEquippedProgress_getter, equippedProgress_getter; // ItemRenderer
|
||||
renderPosX_getter, renderPosY_getter, renderPosZ_getter; // RenderManager
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -34,38 +30,6 @@ public final class ClientMethodHandles {
|
||||
f = ReflectionHelper.findField(RenderManager.class, LibObfuscation.RENDERPOSZ);
|
||||
f.setAccessible(true);
|
||||
renderPosZ_getter = MethodHandles.publicLookup().unreflectGetter(f);
|
||||
|
||||
f = ReflectionHelper.findField(EntityRenderer.class, LibObfuscation.FAR_PLANE_DISTANCE);
|
||||
f.setAccessible(true);
|
||||
farPlaneDistance_getter = MethodHandles.publicLookup().unreflectGetter(f);
|
||||
|
||||
Method m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.HURT_CAMERA_EFFECT, float.class);
|
||||
m.setAccessible(true);
|
||||
hurtCameraEffect = MethodHandles.publicLookup().unreflect(m);
|
||||
|
||||
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.SETUP_VIEW_BOBBING, float.class);
|
||||
m.setAccessible(true);
|
||||
setupViewBobbing = MethodHandles.publicLookup().unreflect(m);
|
||||
|
||||
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.ENABLE_LIGHTMAP);
|
||||
m.setAccessible(true);
|
||||
enableLightmap = MethodHandles.publicLookup().unreflect(m);
|
||||
|
||||
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.DISABLE_LIGHTMAP);
|
||||
m.setAccessible(true);
|
||||
disableLightmap = MethodHandles.publicLookup().unreflect(m);
|
||||
|
||||
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.GET_FOV_MODIFIER, float.class, boolean.class);
|
||||
m.setAccessible(true);
|
||||
getFOVModifier = MethodHandles.publicLookup().unreflect(m);
|
||||
|
||||
// f = ReflectionHelper.findField(ItemRenderer.class, LibObfuscation.PREV_EQUIPPED_PROGRESS);
|
||||
// f.setAccessible(true);
|
||||
// prevEquippedProgress_getter = MethodHandles.publicLookup().unreflectGetter(f);
|
||||
//
|
||||
// f = ReflectionHelper.findField(ItemRenderer.class, LibObfuscation.EQUIPPED_PROGRESS);
|
||||
// f.setAccessible(true);
|
||||
// equippedProgress_getter = MethodHandles.publicLookup().unreflectGetter(f);
|
||||
} catch (IllegalAccessException e) {
|
||||
Botania.LOGGER.fatal("Couldn't initialize client methodhandles! Things will be broken!");
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -28,7 +28,9 @@ import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class ClientTickHandler {
|
||||
public final class ClientTickHandler {
|
||||
|
||||
private ClientTickHandler() {}
|
||||
|
||||
public static int ticksWithLexicaOpen = 0;
|
||||
public static int pageFlipTicks = 0;
|
||||
@@ -37,24 +39,23 @@ public class ClientTickHandler {
|
||||
public static float delta = 0;
|
||||
public static float total = 0;
|
||||
|
||||
private void calcDelta() {
|
||||
private static void calcDelta() {
|
||||
float oldTotal = total;
|
||||
total = ticksInGame + partialTicks;
|
||||
delta = total - oldTotal;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void renderTick(RenderTickEvent event) {
|
||||
public static void renderTick(RenderTickEvent event) {
|
||||
if(event.phase == Phase.START)
|
||||
partialTicks = event.renderTickTime;
|
||||
else {
|
||||
TooltipAdditionDisplayHandler.render();
|
||||
calcDelta();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void clientTickEnd(ClientTickEvent event) {
|
||||
public static void clientTickEnd(ClientTickEvent event) {
|
||||
if(event.phase == Phase.END) {
|
||||
RedStringRenderer.tick();
|
||||
ItemsRemainingRenderHandler.tick();
|
||||
|
||||
@@ -41,25 +41,17 @@ public final class ColorHandler {
|
||||
|
||||
// 16 colors
|
||||
blocks.registerBlockColorHandler(
|
||||
new IBlockColor() {
|
||||
@Override
|
||||
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
|
||||
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
|
||||
}
|
||||
},
|
||||
(state, world, pos, tintIndex) -> state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue,
|
||||
ModBlocks.specialFlower, ModBlocks.manaBeacon, ModBlocks.petalBlock, ModBlocks.unstableBlock);
|
||||
|
||||
// Pool
|
||||
blocks.registerBlockColorHandler(
|
||||
new IBlockColor() {
|
||||
@Override
|
||||
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
|
||||
if (state.getValue(BotaniaStateProps.POOL_VARIANT) == PoolVariant.FABULOUS) {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
return Color.HSBtoRGB(time * 0.005F, 0.6F, 1F);
|
||||
} else {
|
||||
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
|
||||
}
|
||||
(state, world, pos, tintIndex) -> {
|
||||
if (state.getValue(BotaniaStateProps.POOL_VARIANT) == PoolVariant.FABULOUS) {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
return Color.HSBtoRGB(time * 0.005F, 0.6F, 1F);
|
||||
} else {
|
||||
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
|
||||
}
|
||||
},
|
||||
ModBlocks.pool
|
||||
@@ -67,47 +59,40 @@ public final class ColorHandler {
|
||||
|
||||
// Spreader
|
||||
blocks.registerBlockColorHandler(
|
||||
new IBlockColor() {
|
||||
@Override
|
||||
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
|
||||
if(state.getValue(BotaniaStateProps.SPREADER_VARIANT) != SpreaderVariant.GAIA)
|
||||
return 0xFFFFFF;
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
return Color.HSBtoRGB((time * 5) % 360 / 360F, 0.4F, 0.9F);
|
||||
}
|
||||
(state, world, pos, tintIndex) -> {
|
||||
if(state.getValue(BotaniaStateProps.SPREADER_VARIANT) != SpreaderVariant.GAIA)
|
||||
return 0xFFFFFF;
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
return Color.HSBtoRGB((time * 5) % 360 / 360F, 0.4F, 0.9F);
|
||||
},
|
||||
ModBlocks.spreader
|
||||
);
|
||||
|
||||
// Platforms
|
||||
blocks.registerBlockColorHandler(
|
||||
new IBlockColor() {
|
||||
@Override
|
||||
public int colorMultiplier(@Nonnull IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (world != null && pos != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
IBlockState camoState = camo.camoState;
|
||||
if(camoState != null)
|
||||
return camoState.getBlock() instanceof BlockCamo ? 0xFFFFFF : Minecraft.getMinecraft().getBlockColors().colorMultiplier(camoState, world, pos, tintIndex);
|
||||
}
|
||||
(state, world, pos, tintIndex) -> {
|
||||
if (world != null && pos != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
IBlockState camoState = camo.camoState;
|
||||
if(camoState != null)
|
||||
return camoState.getBlock() instanceof BlockCamo
|
||||
? 0xFFFFFF
|
||||
: Minecraft.getMinecraft().getBlockColors().colorMultiplier(camoState, world, pos, tintIndex);
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}, ModBlocks.platform);
|
||||
|
||||
ItemColors items = Minecraft.getMinecraft().getItemColors();
|
||||
|
||||
items.registerItemColorHandler(new IItemColor() {
|
||||
@Override
|
||||
public int getColorFromItemstack(@Nonnull ItemStack stack, int tintIndex) {
|
||||
Item item = stack.getItem();
|
||||
if (item instanceof IColorable) {
|
||||
return ((IColorable) item).getColorFromItemStack(stack, tintIndex);
|
||||
} else {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
items.registerItemColorHandler((stack, tintIndex) -> {
|
||||
Item item = stack.getItem();
|
||||
if (item instanceof IColorable) {
|
||||
return ((IColorable) item).getColorFromItemStack(stack, tintIndex);
|
||||
} else {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
}, ModItems.manaResource, ModItems.twigWand, ModItems.dye, ModItems.petal, ModItems.manaGun, ModItems.manaMirror, ModItems.manaTablet, ModItems.signalFlare,
|
||||
ModItems.spellCloth, ModItems.brewFlask, ModItems.brewVial, ModItems.incenseStick, ModItems.bloodPendant, ModItems.enderDagger,
|
||||
|
||||
@@ -10,12 +10,17 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.lwjgl.opengl.ARBFragmentShader;
|
||||
import org.lwjgl.opengl.ContextCapabilities;
|
||||
@@ -27,17 +32,20 @@ import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class DebugHandler {
|
||||
|
||||
private DebugHandler() {}
|
||||
|
||||
private static final String PREFIX = TextFormatting.GREEN + "[Botania] " + TextFormatting.RESET;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrawDebugText(RenderGameOverlayEvent.Text event) {
|
||||
public static void onDrawDebugText(RenderGameOverlayEvent.Text event) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if(Minecraft.getMinecraft().gameSettings.showDebugInfo) {
|
||||
event.getLeft().add(null);
|
||||
event.getLeft().add("");
|
||||
String version = LibMisc.VERSION;
|
||||
if(version.contains("GRADLE"))
|
||||
version = "N/A";
|
||||
@@ -68,6 +76,23 @@ public final class DebugHandler {
|
||||
event.getLeft().add(" GL_ARB_multitexture: " + caps.GL_ARB_multitexture);
|
||||
event.getLeft().add(" GL_ARB_texture_non_power_of_two: " + caps.GL_ARB_texture_non_power_of_two);
|
||||
event.getLeft().add(" OpenGL13: " + caps.OpenGL13);
|
||||
|
||||
if (Minecraft.getMinecraft().objectMouseOver != null
|
||||
&& Minecraft.getMinecraft().objectMouseOver.getBlockPos() != null) {
|
||||
BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos();
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
state = state.getActualState(world, pos);
|
||||
state = state.getBlock().getExtendedState(state, world, pos);
|
||||
if (state instanceof IExtendedBlockState) {
|
||||
try {
|
||||
for (Map.Entry<IUnlistedProperty<?>, Optional<?>> e : ((IExtendedBlockState) state).getUnlistedProperties().entrySet()) {
|
||||
event.getRight().add(TextFormatting.LIGHT_PURPLE + e.getKey().getName() + ": " + TextFormatting.RESET + e.getValue().orNull());
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
event.getRight().add("Error getting extended state");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(Minecraft.IS_RUNNING_ON_MAC)
|
||||
event.getLeft().add(PREFIX + "SHIFT+CMD for context");
|
||||
else event.getLeft().add(PREFIX + "SHIFT+CTRL for context");
|
||||
|
||||
@@ -70,10 +70,12 @@ import java.awt.*;
|
||||
|
||||
public final class HUDHandler {
|
||||
|
||||
private HUDHandler() {}
|
||||
|
||||
public static final ResourceLocation manaBar = new ResourceLocation(LibResources.GUI_MANA_HUD);
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
|
||||
public static void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
@@ -90,7 +92,7 @@ public final class HUDHandler {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
|
||||
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
ItemStack main = mc.thePlayer.getHeldItemMainhand();
|
||||
@@ -221,7 +223,7 @@ public final class HUDHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void renderWandModeDisplay(ItemStack stack, ScaledResolution res) {
|
||||
private static void renderWandModeDisplay(ItemStack stack, ScaledResolution res) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
@@ -244,7 +246,7 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private void renderManaInvBar(ScaledResolution res, boolean hasCreative, int totalMana, int totalMaxMana) {
|
||||
private static void renderManaInvBar(ScaledResolution res, boolean hasCreative, int totalMana, int totalMaxMana) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int width = 182;
|
||||
int x = res.getScaledWidth() / 2 - width / 2;
|
||||
@@ -273,7 +275,7 @@ public final class HUDHandler {
|
||||
GL11.glColor4ub(((byte) 255), ((byte) 255), ((byte) 255), ((byte) 255));
|
||||
}
|
||||
|
||||
private void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
|
||||
private static void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
@@ -305,7 +307,7 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private void renderCrystalCubeHUD(ScaledResolution res, TileCorporeaCrystalCube tile) {
|
||||
private static void renderCrystalCubeHUD(ScaledResolution res, TileCorporeaCrystalCube tile) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
@@ -331,7 +333,7 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private void drawLexiconHUD(ItemStack stack, IBlockState state, RayTraceResult pos, ScaledResolution res) {
|
||||
private static void drawLexiconHUD(ItemStack stack, IBlockState state, RayTraceResult pos, ScaledResolution res) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Block block = state.getBlock();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
@@ -398,7 +400,7 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private void renderNearIndexDisplay(ScaledResolution res) {
|
||||
private static void renderNearIndexDisplay(ScaledResolution res) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
String txt0 = I18n.format("botaniamisc.nearIndex0");
|
||||
String txt1 = TextFormatting.GRAY + I18n.format("botaniamisc.nearIndex1");
|
||||
|
||||
@@ -30,13 +30,15 @@ import java.util.Deque;
|
||||
|
||||
public class LightningHandler {
|
||||
|
||||
private LightningHandler() {}
|
||||
|
||||
private static final int BATCH_THRESHOLD = 200;
|
||||
private static final ResourceLocation outsideResource = new ResourceLocation(LibResources.MISC_WISP_LARGE);
|
||||
private static final ResourceLocation insideResource = new ResourceLocation(LibResources.MISC_WISP_SMALL);
|
||||
public static final Deque<FXLightning> queuedLightningBolts = new ArrayDeque<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
public static void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
|
||||
|
||||
profiler.startSection("botania-particles");
|
||||
|
||||
@@ -10,6 +10,7 @@ package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
@@ -24,6 +25,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.model.FloatingFlowerModel;
|
||||
import vazkii.botania.client.model.GunModel;
|
||||
import vazkii.botania.client.model.LexiconModel;
|
||||
import vazkii.botania.client.model.PlatformModel;
|
||||
import vazkii.botania.common.Botania;
|
||||
@@ -97,6 +99,15 @@ public class MiscellaneousIcons {
|
||||
|
||||
// Lexicon
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:lexicon", "inventory"), new LexiconModel());
|
||||
|
||||
// Mana Blaster
|
||||
ModelResourceLocation key = new ModelResourceLocation("botania:manaGun", "inventory");
|
||||
IBakedModel originalModel = evt.getModelRegistry().getObject(key);
|
||||
evt.getModelRegistry().putObject(key, new GunModel(originalModel));
|
||||
|
||||
key = new ModelResourceLocation("botania:manaGunClip", "inventory");
|
||||
originalModel = evt.getModelRegistry().getObject(key);
|
||||
evt.getModelRegistry().putObject(key, new GunModel(originalModel));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -8,52 +8,25 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoublePlant;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.BlockSkull;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.RegistryDelegate;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.AltGrassVariant;
|
||||
import vazkii.botania.api.state.enums.AltarVariant;
|
||||
import vazkii.botania.api.state.enums.BiomeBrickVariant;
|
||||
import vazkii.botania.api.state.enums.BiomeStoneVariant;
|
||||
import vazkii.botania.api.state.enums.CrateVariant;
|
||||
import vazkii.botania.api.state.enums.CustomBrickVariant;
|
||||
import vazkii.botania.api.state.enums.DrumVariant;
|
||||
import vazkii.botania.api.state.enums.EndBrickVariant;
|
||||
import vazkii.botania.api.state.enums.FutureStoneVariant;
|
||||
import vazkii.botania.api.state.enums.LivingRockVariant;
|
||||
import vazkii.botania.api.state.enums.LivingWoodVariant;
|
||||
import vazkii.botania.api.state.enums.LuminizerVariant;
|
||||
import vazkii.botania.api.state.enums.PlatformVariant;
|
||||
import vazkii.botania.api.state.enums.PoolVariant;
|
||||
import vazkii.botania.api.state.enums.PrismarineVariant;
|
||||
import vazkii.botania.api.state.enums.PylonVariant;
|
||||
import vazkii.botania.api.state.enums.SpreaderVariant;
|
||||
import vazkii.botania.api.state.enums.StorageVariant;
|
||||
import vazkii.botania.client.model.SpecialFlowerModel;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.ModFluffBlocks;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockModSlab;
|
||||
import vazkii.botania.common.block.subtile.SubTileDecor;
|
||||
import vazkii.botania.common.block.subtile.SubTileManastar;
|
||||
import vazkii.botania.common.block.subtile.SubTilePureDaisy;
|
||||
@@ -97,28 +70,12 @@ import vazkii.botania.common.block.subtile.generating.SubTileNightshade;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileRafflowsia;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileSpectrolus;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileThermalily;
|
||||
import vazkii.botania.common.block.tile.TileAvatar;
|
||||
import vazkii.botania.common.block.tile.TileBrewery;
|
||||
import vazkii.botania.common.block.tile.TileGaiaHead;
|
||||
import vazkii.botania.common.block.tile.TileHourglass;
|
||||
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
import vazkii.botania.common.block.tile.mana.TileBellows;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.brew.ItemBrewBase;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
import vazkii.botania.common.item.relic.ItemInfiniteFruit;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static vazkii.botania.common.item.ModItems.*;
|
||||
import java.util.Map;
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
public final class ModelHandler {
|
||||
|
||||
@@ -126,88 +83,17 @@ public final class ModelHandler {
|
||||
ModelLoaderRegistry.registerLoader(SpecialFlowerModel.Loader.INSTANCE);
|
||||
OBJLoader.INSTANCE.addDomain(LibMisc.MOD_ID.toLowerCase(Locale.ROOT));
|
||||
|
||||
/** Subtile block models **/
|
||||
registerSubtiles();
|
||||
|
||||
/** Custom statemappers **/
|
||||
registerStateMappers();
|
||||
for(Block block : Block.REGISTRY) {
|
||||
if(block instanceof IModelRegister)
|
||||
((IModelRegister) block).registerModels();
|
||||
}
|
||||
|
||||
/** ItemBlocks **/
|
||||
registerStandardBlocks();
|
||||
registerMushrooms();
|
||||
registerFlowers();
|
||||
registerPavement();
|
||||
registerStairs();
|
||||
registerSlabs();
|
||||
registerWalls();
|
||||
registerPanes();
|
||||
registerAltars();
|
||||
registerQuartzBlocks();
|
||||
registerLuminizers();
|
||||
|
||||
/** Normal Items **/
|
||||
registerStandardItems();
|
||||
registerTESRItems();
|
||||
registerManaResources();
|
||||
registerRunes();
|
||||
registerLens();
|
||||
registerBrews();
|
||||
|
||||
/** Special Item Meshers **/
|
||||
// Cannot use lambdas directly yet because FG/SS can't reobfuscate them, need a dummy wrapper
|
||||
// See https://github.com/MinecraftForge/ForgeGradle/issues/314.
|
||||
|
||||
ModelLoader.registerItemVariants(Item.getItemFromBlock(ModBlocks.pool),
|
||||
new ModelResourceLocation("botania:pool", "variant=default"),
|
||||
new ModelResourceLocation("botania:pool", "variant=diluted"),
|
||||
new ModelResourceLocation("botania:pool", "variant=creative"),
|
||||
new ModelResourceLocation("botania:pool", "variant=fabulous"),
|
||||
new ModelResourceLocation("botania:pool", "default_full"),
|
||||
new ModelResourceLocation("botania:pool", "diluted_full"),
|
||||
new ModelResourceLocation("botania:pool", "creative_full"),
|
||||
new ModelResourceLocation("botania:pool", "fabulous_full"));
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(ModBlocks.pool), MesherWrapper.of(stack -> {
|
||||
int meta = stack.getMetadata();
|
||||
if (meta < 0 || meta > 3)
|
||||
meta = 0;
|
||||
PoolVariant v = PoolVariant.values()[meta];
|
||||
boolean renderFull = v == PoolVariant.CREATIVE || (stack.hasTagCompound() && stack.getTagCompound().getBoolean("RenderFull"));
|
||||
return new ModelResourceLocation("botania:pool", renderFull ? v.getName() + "_full" : "variant=" + v.getName());
|
||||
}));
|
||||
|
||||
ModelLoader.registerItemVariants(elementiumShears,
|
||||
new ModelResourceLocation("botania:elementiumShears", "inventory"),
|
||||
new ModelResourceLocation("botania:dammitReddit", "inventory"));
|
||||
ModelLoader.setCustomMeshDefinition(elementiumShears, MesherWrapper.of(stack ->
|
||||
stack.getDisplayName().equalsIgnoreCase("dammit reddit")
|
||||
? new ModelResourceLocation("botania:dammitReddit", "inventory")
|
||||
: new ModelResourceLocation("botania:elementiumShears", "inventory")));
|
||||
|
||||
ModelLoader.registerItemVariants(grassHorn,
|
||||
new ModelResourceLocation("botania:grassHorn0", "inventory"),
|
||||
new ModelResourceLocation("botania:grassHorn1", "inventory"),
|
||||
new ModelResourceLocation("botania:grassHorn2", "inventory"),
|
||||
new ModelResourceLocation("botania:vuvuzela", "inventory"));
|
||||
ModelLoader.setCustomMeshDefinition(grassHorn, MesherWrapper.of(stack ->
|
||||
stack.getDisplayName().toLowerCase().contains("vuvuzela")
|
||||
? new ModelResourceLocation("botania:vuvuzela", "inventory")
|
||||
: new ModelResourceLocation("botania:grassHorn" + stack.getMetadata(), "inventory")));
|
||||
|
||||
ModelLoader.registerItemVariants(infiniteFruit,
|
||||
new ModelResourceLocation("botania:infiniteFruit", "inventory"),
|
||||
new ModelResourceLocation("botania:infiniteFruitBoot", "inventory"));
|
||||
ModelLoader.setCustomMeshDefinition(infiniteFruit, MesherWrapper.of(stack ->
|
||||
ItemInfiniteFruit.isBoot(stack)
|
||||
? new ModelResourceLocation("botania:infiniteFruitBoot", "inventory")
|
||||
: new ModelResourceLocation("botania:infiniteFruit", "inventory")));
|
||||
|
||||
ModelLoader.registerItemVariants(manaCookie,
|
||||
new ModelResourceLocation("botania:manaCookie", "inventory"),
|
||||
new ModelResourceLocation("botania:totalBiscuit", "inventory"));
|
||||
ModelLoader.setCustomMeshDefinition(manaCookie, MesherWrapper.of(stack ->
|
||||
stack.getDisplayName().toLowerCase().equals("totalbiscuit")
|
||||
? new ModelResourceLocation("botania:totalBiscuit", "inventory")
|
||||
: new ModelResourceLocation("botania:manaCookie", "inventory")));
|
||||
for(Item item : Item.REGISTRY) {
|
||||
if(item instanceof IModelRegister)
|
||||
((IModelRegister) item).registerModels();
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerSubtiles() {
|
||||
@@ -281,688 +167,67 @@ public final class ModelHandler {
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileBergamute.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BERGAMUTE));
|
||||
}
|
||||
|
||||
private static void registerStandardBlocks() {
|
||||
registerItemModel(ModBlocks.alchemyCatalyst);
|
||||
registerItemModel(ModBlocks.alfPortal);
|
||||
registerItemModel(ModBlocks.bifrost);
|
||||
registerItemModel(ModBlocks.bifrostPerm);
|
||||
registerItemModel(ModBlocks.blazeBlock);
|
||||
registerItemModel(ModBlocks.cacophonium);
|
||||
registerItemModel(ModBlocks.cellBlock);
|
||||
registerItemModel(ModBlocks.conjurationCatalyst);
|
||||
registerItemModel(ModBlocks.cocoon);
|
||||
registerItemModel(ModBlocks.corporeaFunnel);
|
||||
registerItemModel(ModBlocks.corporeaInterceptor);
|
||||
registerItemModel(ModBlocks.corporeaRetainer);
|
||||
registerItemModel(ModBlocks.dirtPath);
|
||||
registerItemModel(ModBlocks.distributor);
|
||||
registerItemModel(ModBlocks.elfGlass);
|
||||
registerItemModel(ModBlocks.enchantedSoil);
|
||||
registerItemModel(ModBlocks.enchanter);
|
||||
registerItemModel(ModBlocks.enderEye);
|
||||
registerItemModel(ModBlocks.felPumpkin);
|
||||
registerItemModel(ModBlocks.floatingSpecialFlower);
|
||||
registerItemModel(ModBlocks.forestEye);
|
||||
registerItemModel(ModBlocks.ghostRail);
|
||||
registerItemModel(ModBlocks.incensePlate);
|
||||
registerItemModel(ModBlocks.lightLauncher);
|
||||
registerItemModel(ModBlocks.manaBomb);
|
||||
registerItemModel(ModBlocks.manaDetector);
|
||||
registerItemModel(ModBlocks.manaGlass);
|
||||
registerItemModel(ModBlocks.manaVoid);
|
||||
registerItemModel(ModBlocks.prism);
|
||||
registerItemModel(ModBlocks.pistonRelay);
|
||||
registerItemModel(ModBlocks.pump);
|
||||
registerItemModel(ModBlocks.redStringComparator);
|
||||
registerItemModel(ModBlocks.redStringContainer);
|
||||
registerItemModel(ModBlocks.redStringDispenser);
|
||||
registerItemModel(ModBlocks.redStringFertilizer);
|
||||
registerItemModel(ModBlocks.redStringInterceptor);
|
||||
registerItemModel(ModBlocks.redStringRelay);
|
||||
registerItemModel(ModBlocks.reedBlock);
|
||||
registerItemModel(ModBlocks.rfGenerator);
|
||||
registerItemModel(ModBlocks.root);
|
||||
registerItemModel(ModBlocks.runeAltar);
|
||||
registerItemModel(ModBlocks.seaLamp);
|
||||
registerItemModel(ModBlocks.shimmerrock);
|
||||
registerItemModel(ModBlocks.shimmerwoodPlanks);
|
||||
registerItemModel(ModBlocks.sparkChanger);
|
||||
registerItemModel(ModBlocks.spawnerClaw);
|
||||
registerItemModel(ModBlocks.specialFlower);
|
||||
registerItemModel(ModBlocks.starfield);
|
||||
registerItemModel(ModBlocks.thatch);
|
||||
registerItemModel(ModBlocks.terraPlate);
|
||||
registerItemModel(ModBlocks.tinyPlanet);
|
||||
registerItemModel(ModBlocks.tinyPotato);
|
||||
registerItemModel(ModBlocks.turntable);
|
||||
|
||||
// Register all metas to variant inventory, so the smartmodel can take over from there. See MiscellaneousIcons
|
||||
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.floatingFlower), EnumDyeColor.values().length);
|
||||
|
||||
// Item models which all use the same base model and recolored by render layer
|
||||
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.manaBeacon), EnumDyeColor.values().length);
|
||||
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.petalBlock), EnumDyeColor.values().length);
|
||||
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.unstableBlock), EnumDyeColor.values().length);
|
||||
|
||||
// Blocks which share models with their item, and have only one variant to switch over
|
||||
registerVariantsDefaulted(ModBlocks.pylon, PylonVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.altGrass, AltGrassVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModFluffBlocks.biomeStoneA, BiomeStoneVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModFluffBlocks.biomeStoneB, BiomeBrickVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.customBrick, CustomBrickVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.endStoneBrick, EndBrickVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.dreamwood, LivingWoodVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.forestDrum, DrumVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.livingrock, LivingRockVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.livingwood, LivingWoodVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.openCrate, CrateVariant.class, "pattern=none,variant");
|
||||
registerVariantsDefaulted(ModBlocks.platform, PlatformVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.prismarine, PrismarineVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.spreader, SpreaderVariant.class, "variant");
|
||||
// todo 1.8 this is temporary until animation API is done, currnetly item model textures will not match true spreader texture
|
||||
registerVariantsDefaulted(ModFluffBlocks.stone, FutureStoneVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.storage, StorageVariant.class, "variant");
|
||||
public static void registerItemAllMeta(Item item, int range) {
|
||||
registerItemMetas(item, range, i -> item.getRegistryName().getResourcePath());
|
||||
}
|
||||
|
||||
private static void registerStandardItems() {
|
||||
registerItemModel(manasteelSword);
|
||||
registerItemModel(spawnerMover);
|
||||
registerItemModel(terraPick);
|
||||
registerItemModel(magnetRing);
|
||||
registerItemModel(magnetRingGreater);
|
||||
registerItemModel(manaGun);
|
||||
registerItemModel(tornadoRod);
|
||||
|
||||
registerItemModel(twigWand);
|
||||
registerItemModel(pestleAndMortar);
|
||||
registerItemModel(blackLotus);
|
||||
registerItemModel(blackLotus, 1);
|
||||
ModelLoader.registerItemVariants(lexicon, new ModelResourceLocation("botania:lexicon_default", "inventory"));
|
||||
registerItemModel(lexicon);
|
||||
|
||||
registerItemModel(manasteelHelm);
|
||||
registerItemModel(manasteelHelmRevealing);
|
||||
registerItemModel(manasteelChest);
|
||||
registerItemModel(manasteelLegs);
|
||||
registerItemModel(manasteelBoots);
|
||||
|
||||
registerItemModel(manasteelPick);
|
||||
registerItemModel(manasteelShovel);
|
||||
registerItemModel(manasteelAxe);
|
||||
registerItemModel(manasteelShears);
|
||||
|
||||
registerItemModel(manaweaveHelm);
|
||||
registerItemModel(manaweaveChest);
|
||||
registerItemModel(manaweaveLegs);
|
||||
registerItemModel(manaweaveBoots);
|
||||
|
||||
registerItemModel(elementiumHelm);
|
||||
registerItemModel(elementiumHelmRevealing);
|
||||
registerItemModel(elementiumChest);
|
||||
registerItemModel(elementiumLegs);
|
||||
registerItemModel(elementiumBoots);
|
||||
|
||||
registerItemModel(elementiumPick);
|
||||
registerItemModel(elementiumShovel);
|
||||
registerItemModel(elementiumAxe);
|
||||
registerItemModel(elementiumSword);
|
||||
|
||||
registerItemModel(terrasteelHelm);
|
||||
registerItemModel(terrasteelHelmRevealing);
|
||||
registerItemModel(terrasteelChest);
|
||||
registerItemModel(terrasteelLegs);
|
||||
registerItemModel(terrasteelBoots);
|
||||
registerItemModel(terraSword);
|
||||
registerItemModel(terraAxe);
|
||||
|
||||
registerItemModel(starSword);
|
||||
registerItemModel(thunderSword);
|
||||
registerItemModel(crystalBow);
|
||||
registerItemModel(livingwoodBow);
|
||||
registerItemModel(glassPick);
|
||||
|
||||
registerItemModel(flowerBag);
|
||||
registerItemModel(fertilizer);
|
||||
registerItemModel(obedienceStick);
|
||||
|
||||
registerItemModel(dirtRod);
|
||||
registerItemModel(waterRod);
|
||||
registerItemModel(cobbleRod);
|
||||
registerItemModel(fireRod);
|
||||
registerItemModel(rainbowRod);
|
||||
registerItemModel(skyDirtRod);
|
||||
registerItemModel(terraformRod);
|
||||
registerItemModel(diviningRod);
|
||||
registerItemModel(gravityRod);
|
||||
registerItemModel(missileRod);
|
||||
registerItemModel(smeltRod);
|
||||
registerItemModel(exchangeRod);
|
||||
|
||||
registerItemModel(openBucket);
|
||||
registerItemModel(bloodPendant);
|
||||
registerItemModel(manaTablet);
|
||||
registerItemModel(enderDagger);
|
||||
registerItemModel(slingshot);
|
||||
registerItemModel(vineBall);
|
||||
registerItemModel(regenIvy);
|
||||
registerItemModel(keepIvy);
|
||||
registerItemModel(recordGaia1);
|
||||
registerItemModel(recordGaia2);
|
||||
registerItemModel(overgrowthSeed);
|
||||
registerItemModel(worldSeed);
|
||||
registerItemModel(incenseStick);
|
||||
registerItemModel(enderHand);
|
||||
registerItemModel(craftingHalo);
|
||||
registerItemModel(spellCloth);
|
||||
registerItemModel(autocraftingHalo);
|
||||
registerItemModel(sextant);
|
||||
registerItemModel(cacophonium);
|
||||
registerItemModel(clip);
|
||||
registerItemModel(phantomInk);
|
||||
registerItemModel(poolMinecart);
|
||||
registerItemModel(pinkinator);
|
||||
registerItemModel(dice);
|
||||
registerItemModel(kingKey);
|
||||
registerItemModel(flugelEye);
|
||||
registerItemModel(thorRing);
|
||||
registerItemModel(lokiRing);
|
||||
registerItemModel(odinRing);
|
||||
registerItemModel(aesirRing);
|
||||
registerItemModel(baubleBox);
|
||||
registerItemModel(tinyPlanet);
|
||||
registerItemModel(manaRing);
|
||||
registerItemModel(manaRingGreater);
|
||||
registerItemModel(auraRing);
|
||||
registerItemModel(auraRingGreater);
|
||||
registerItemModel(spark);
|
||||
|
||||
registerItemModel(waterRing);
|
||||
registerItemModel(miningRing);
|
||||
registerItemModel(reachRing);
|
||||
registerItemModel(swapRing);
|
||||
registerItemModel(pixieRing);
|
||||
registerItemModel(travelBelt);
|
||||
registerItemModel(superTravelBelt);
|
||||
registerItemModel(speedUpBelt);
|
||||
registerItemModel(knockbackBelt);
|
||||
registerItemModel(itemFinder);
|
||||
registerItemModel(monocle);
|
||||
registerItemModel(icePendant);
|
||||
registerItemModel(lavaPendant);
|
||||
registerItemModel(superLavaPendant);
|
||||
registerItemModel(holyCloak);
|
||||
registerItemModel(unholyCloak);
|
||||
registerItemModel(goldLaurel);
|
||||
registerItemModel(flightTiara);
|
||||
registerItemModel(divaCharm);
|
||||
registerItemModel(manaMirror);
|
||||
registerItemModel(manaInkwell);
|
||||
registerItemModel(waterBowl);
|
||||
|
||||
registerItemModelAllMeta(flightTiara, ItemFlightTiara.WING_TYPES);
|
||||
registerItemModelAllMeta(laputaShard, 20);
|
||||
registerItemModelAllMeta(signalFlare, EnumDyeColor.values().length);
|
||||
registerItemModelAllMeta(dye, EnumDyeColor.values().length);
|
||||
registerItemModelAllMeta(petal, EnumDyeColor.values().length);
|
||||
|
||||
registerItemModelMetas(sparkUpgrade, LibItemNames.SPARK_UPGRADE, 4);
|
||||
registerItemModelMetas(corporeaSpark, LibItemNames.CORPOREA_SPARK, 2);
|
||||
registerItemModelMetas(manaBottle, LibItemNames.MANA_BOTTLE, 6);
|
||||
registerItemModelMetas(ancientWill, LibItemNames.ANCIENT_WILL, 6);
|
||||
registerItemModelMetas(temperanceStone, LibItemNames.TEMPERANCE_STONE, 2);
|
||||
registerItemModelMetas(thornChakram, LibItemNames.THORN_CHAKRAM, 2);
|
||||
registerItemModelMetas(blackHoleTalisman, LibItemNames.BLACK_HOLE_TALISMAN, 2);
|
||||
registerItemModelMetas(slimeBottle, LibItemNames.SLIME_BOTTLE, 2);
|
||||
registerItemModelMetas(grassSeeds, LibItemNames.GRASS_SEEDS, 9);
|
||||
registerItemModelMetas(quartz, LibItemNames.QUARTZ, 7);
|
||||
registerItemModelMetas(cosmetic, LibItemNames.COSMETIC, 32);
|
||||
registerItemModelMetas(craftPattern, LibItemNames.CRAFT_PATTERN, 9);
|
||||
registerItemModelMetas(virus, LibItemNames.VIRUS, 2);
|
||||
public static void registerItemAppendMeta(Item item, int maxExclusive, String loc) {
|
||||
registerItemMetas(item, maxExclusive, i -> loc + i);
|
||||
}
|
||||
|
||||
// Only for models that absolutely can't be converted to JSON. Use VERY sparingly
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void registerTESRItems() {
|
||||
registerItemModel(ModBlocks.avatar);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.avatar), 0, TileAvatar.class);
|
||||
|
||||
registerItemModel(ModBlocks.bellows);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.bellows), 0, TileBellows.class);
|
||||
|
||||
registerItemModel(ModBlocks.brewery);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.brewery), 0, TileBrewery.class);
|
||||
|
||||
registerItemModel(ModBlocks.corporeaCrystalCube);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.corporeaCrystalCube), 0, TileCorporeaCrystalCube.class);
|
||||
|
||||
registerItemModel(ModBlocks.corporeaIndex);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.corporeaIndex), 0, TileCorporeaIndex.class);
|
||||
|
||||
registerItemModel(ModItems.gaiaHead);
|
||||
ForgeHooksClient.registerTESRItemStack(ModItems.gaiaHead, 0, TileGaiaHead.class);
|
||||
|
||||
registerItemModel(ModBlocks.hourglass);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.hourglass), 0, TileHourglass.class);
|
||||
|
||||
registerItemModel(ModBlocks.teruTeruBozu);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.teruTeruBozu), 0, TileTeruTeruBozu.class);
|
||||
}
|
||||
|
||||
private static void registerManaResources() {
|
||||
Item item = manaResource;
|
||||
for (int i = 0; i < LibItemNames.MANA_RESOURCE_NAMES.length; i++) {
|
||||
String name = "botania:" + LibItemNames.MANA_RESOURCE_NAMES[i];
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, "inventory"));
|
||||
public static void registerItemMetas(Item item, int maxExclusive, IntFunction<String> metaToName) {
|
||||
for (int i = 0; i < maxExclusive; i++) {
|
||||
ModelLoader.setCustomModelResourceLocation(
|
||||
item, i,
|
||||
new ModelResourceLocation(LibMisc.MOD_ID + ":" + metaToName.apply(i), "inventory")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerRunes() {
|
||||
List<String> variantNames = ImmutableList.of("water", "fire", "earth", "air", "spring", "summer", "autumn", "winter", "mana", "lust", "gluttony", "greed", "sloth", "wrath", "envy", "pride");
|
||||
for (int i = 0; i < variantNames.size(); i++) {
|
||||
ModelLoader.setCustomModelResourceLocation(rune, i, new ModelResourceLocation("botania:rune_" + variantNames.get(i), "inventory"));
|
||||
}
|
||||
private static final Map<RegistryDelegate<Block>, IStateMapper> customStateMappers = ReflectionHelper.getPrivateValue(ModelLoader.class, null, "customStateMappers");
|
||||
private static final DefaultStateMapper fallbackMapper = new DefaultStateMapper();
|
||||
|
||||
private static ModelResourceLocation getMrlForState(IBlockState state) {
|
||||
return customStateMappers
|
||||
.getOrDefault(state.getBlock().delegate, fallbackMapper)
|
||||
.putStateModelLocations(state.getBlock())
|
||||
.get(state);
|
||||
}
|
||||
|
||||
private static void registerLens() {
|
||||
int counter = 0;
|
||||
for (String s : LibItemNames.LENS_NAMES) {
|
||||
ModelLoader.setCustomModelResourceLocation(lens, counter++, new ModelResourceLocation("botania:" + s, "inventory"));
|
||||
}
|
||||
public static void registerBlockToState(Block b, int meta, IBlockState state) {
|
||||
ModelLoader.setCustomModelResourceLocation(
|
||||
Item.getItemFromBlock(b),
|
||||
meta,
|
||||
getMrlForState(state)
|
||||
);
|
||||
}
|
||||
|
||||
private static void registerBrews() {
|
||||
ModelLoader.setCustomModelResourceLocation(vial, 0, new ModelResourceLocation("botania:vial", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(vial, 1, new ModelResourceLocation("botania:flask", "inventory"));
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
ModelLoader.registerItemVariants(brewFlask, new ModelResourceLocation("botania:flask1_" + i, "inventory"));
|
||||
}
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(brewFlask, MesherWrapper.of(stack -> {
|
||||
int swigsTaken = 6 - ((ItemBrewBase) brewFlask).getSwigsLeft(stack);
|
||||
return new ModelResourceLocation("botania:flask1_" + swigsTaken, "inventory");
|
||||
}));
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ModelLoader.registerItemVariants(brewVial, new ModelResourceLocation("botania:vial1_" + i, "inventory"));
|
||||
}
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(brewVial, MesherWrapper.of(stack -> {
|
||||
int swigsTaken = 4 - ((ItemBrewBase) brewVial).getSwigsLeft(stack);
|
||||
return new ModelResourceLocation("botania:vial1_" + swigsTaken, "inventory");
|
||||
}));
|
||||
public static void registerBlockToState(Block b, int maxExclusive) {
|
||||
for(int i = 0; i < maxExclusive; i++)
|
||||
registerBlockToState(b, i, b.getStateFromMeta(i));
|
||||
}
|
||||
|
||||
private static void registerStateMappers() {
|
||||
// Override to let custom model loader work, see SpecialFlowerModel
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.specialFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).ignore(((BlockFlower) ModBlocks.specialFlower).getTypeProperty()).build());
|
||||
|
||||
// Override to let smart models work, see MiscellaneousIcons
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.floatingSpecialFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.floatingFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.platform, new StateMap.Builder().ignore(BotaniaStateProps.PLATFORM_VARIANT).build());
|
||||
|
||||
// Ignore vanilla facing, variant in double flower
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.doubleFlower1, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.FACING).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.doubleFlower2, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.FACING).build());
|
||||
|
||||
// Ignore color in pool, unstable cube, mana beacon, special flower, and petals (handled by Block.colorMultiplier)
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.pool, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.unstableBlock, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.manaBeacon, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.petalBlock, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.specialFlower, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR, ((BlockFlower) ModBlocks.specialFlower).getTypeProperty()).build());
|
||||
|
||||
// Ignore vanilla variant in flowers
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.flower, (new StateMap.Builder()).ignore(((BlockFlower) ModBlocks.flower).getTypeProperty()).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.shinyFlower, (new StateMap.Builder()).ignore(((BlockFlower) ModBlocks.shinyFlower).getTypeProperty()).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.buriedPetals, (new StateMap.Builder()).ignore(((BlockFlower) ModBlocks.buriedPetals).getTypeProperty()).build());
|
||||
|
||||
// Ignore vanilla variant in walls
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.biomeStoneWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.dreamwoodWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.livingrockWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.livingwoodWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.prismarineWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.reedWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.stoneWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
|
||||
// Ignore dummy variant in slabs
|
||||
for (Block b : ModFluffBlocks.biomeStoneSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.pavementSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.stoneSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
|
||||
}
|
||||
|
||||
List<Block> otherSlabs = Lists.newArrayList(ModFluffBlocks.livingwoodSlab, ModFluffBlocks.livingwoodPlankSlab, ModFluffBlocks.livingrockSlab, ModFluffBlocks.dreamwoodSlab, ModFluffBlocks.livingrockBrickSlab,
|
||||
ModFluffBlocks.dreamwoodPlankSlab, ModFluffBlocks.prismarineSlab, ModFluffBlocks.prismarineBrickSlab, ModFluffBlocks.darkPrismarineSlab,
|
||||
ModFluffBlocks.reedSlab, ModFluffBlocks.thatchSlab, ModFluffBlocks.netherBrickSlab, ModFluffBlocks.soulBrickSlab, ModFluffBlocks.snowBrickSlab,
|
||||
ModFluffBlocks.tileSlab, ModFluffBlocks.manaQuartzSlab, ModFluffBlocks.blazeQuartzSlab, ModFluffBlocks.darkQuartzSlab,
|
||||
ModFluffBlocks.lavenderQuartzSlab, ModFluffBlocks.redQuartzSlab, ModFluffBlocks.elfQuartzSlab, ModFluffBlocks.sunnyQuartzSlab, ModFluffBlocks.dirtPathSlab,
|
||||
ModFluffBlocks.shimmerrockSlab, ModFluffBlocks.shimmerwoodPlankSlab, ModFluffBlocks.endStoneSlab, ModFluffBlocks.enderBrickSlab);
|
||||
|
||||
for (Block b : otherSlabs) {
|
||||
if (b == null) // Dark quartz disabled
|
||||
continue;
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
|
||||
}
|
||||
|
||||
// Ignore both dummy variant and half prop in full slabs
|
||||
for (Block b : ModFluffBlocks.biomeStoneFullSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.pavementFullSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.stoneFullSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
|
||||
}
|
||||
|
||||
List<Block> otherFullSlabs = Lists.newArrayList(ModFluffBlocks.livingwoodSlabFull, ModFluffBlocks.livingwoodPlankSlabFull, ModFluffBlocks.livingrockSlabFull, ModFluffBlocks.dreamwoodSlabFull, ModFluffBlocks.livingrockBrickSlabFull,
|
||||
ModFluffBlocks.dreamwoodPlankSlabFull, ModFluffBlocks.prismarineSlabFull, ModFluffBlocks.prismarineBrickSlabFull, ModFluffBlocks.darkPrismarineSlabFull,
|
||||
ModFluffBlocks.reedSlabFull, ModFluffBlocks.thatchSlabFull, ModFluffBlocks.netherBrickSlabFull, ModFluffBlocks.soulBrickSlabFull, ModFluffBlocks.snowBrickSlabFull,
|
||||
ModFluffBlocks.tileSlabFull, ModFluffBlocks.darkQuartzSlabFull, ModFluffBlocks.manaQuartzSlabFull, ModFluffBlocks.blazeQuartzSlabFull,
|
||||
ModFluffBlocks.lavenderQuartzSlabFull, ModFluffBlocks.redQuartzSlabFull, ModFluffBlocks.elfQuartzSlabFull, ModFluffBlocks.sunnyQuartzSlabFull, ModFluffBlocks.dirtPathSlabFull,
|
||||
ModFluffBlocks.shimmerrockSlabFull, ModFluffBlocks.shimmerwoodPlankSlabFull, ModFluffBlocks.endStoneSlabFull, ModFluffBlocks.enderBrickSlabFull);
|
||||
|
||||
for (Block b : otherFullSlabs) {
|
||||
if (b == null) // Dark quartz disabled
|
||||
continue;
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
|
||||
}
|
||||
|
||||
// Ignore everything in TESR items to suppress missing model errors
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.avatar, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.bellows, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.brewery, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.gaiaHead, new StateMap.Builder().ignore(BlockSkull.FACING, BlockSkull.NODROP).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.hourglass, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build());
|
||||
// Registers the ItemBlock to models/item/<registryname>#inventory
|
||||
public static void registerInventoryVariant(Block b) {
|
||||
ModelLoader.setCustomModelResourceLocation(
|
||||
Item.getItemFromBlock(b), 0,
|
||||
new ModelResourceLocation(b.getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
private static void registerMushrooms() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.mushroom);
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.mushroom).toString();
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
}
|
||||
// Registers the ItemBlock to a custom path in models/item/itemblock/
|
||||
public static void registerCustomItemblock(Block b, String path) {
|
||||
registerCustomItemblock(b, 1, i -> path);
|
||||
}
|
||||
|
||||
private static void registerFlowers() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.flower);
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.flower).toString();
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
}
|
||||
|
||||
item = Item.getItemFromBlock(ModBlocks.shinyFlower);
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.shinyFlower).toString();
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
}
|
||||
|
||||
item = Item.getItemFromBlock(ModBlocks.doubleFlower1);
|
||||
for (EnumDyeColor color : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1.getAllowedValues()) {
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.doubleFlower1).toString();
|
||||
String variant = "inventory_" + color.getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, variant));
|
||||
}
|
||||
|
||||
item = Item.getItemFromBlock(ModBlocks.doubleFlower2);
|
||||
for (EnumDyeColor color : BotaniaStateProps.DOUBLEFLOWER_VARIANT_2.getAllowedValues()) {
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.doubleFlower2).toString();
|
||||
String variant = "inventory_" + color.getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata() - 8, new ModelResourceLocation(name, variant));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerPavement() {
|
||||
Item item = Item.getItemFromBlock(ModFluffBlocks.pavement);
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModFluffBlocks.pavement).toString();
|
||||
|
||||
for (EnumDyeColor e : BotaniaStateProps.PAVEMENT_COLOR.getAllowedValues()) {
|
||||
String variant = "color=" + e.getName();
|
||||
switch (e) { // Explicit switch needed because saved meta does not match EnumDyeColor
|
||||
case BLACK: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case BLUE: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 2, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case RED: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 3, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case YELLOW: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 4, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case GREEN: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 5, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case WHITE:
|
||||
default: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerStairs() {
|
||||
for (Block b : ModFluffBlocks.stoneStairs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.pavementStairs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.biomeStoneStairs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
registerItemModel(ModFluffBlocks.blazeQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.darkPrismarineStairs);
|
||||
if (ConfigHandler.darkQuartzEnabled)
|
||||
registerItemModel(ModFluffBlocks.darkQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.dreamwoodStairs);
|
||||
registerItemModel(ModFluffBlocks.dreamwoodPlankStairs);
|
||||
registerItemModel(ModFluffBlocks.elfQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.enderBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.endStoneStairs);
|
||||
registerItemModel(ModFluffBlocks.lavenderQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.livingrockStairs);
|
||||
registerItemModel(ModFluffBlocks.livingrockBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.livingwoodStairs);
|
||||
registerItemModel(ModFluffBlocks.livingwoodPlankStairs);
|
||||
registerItemModel(ModFluffBlocks.manaQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.netherBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.prismarineStairs);
|
||||
registerItemModel(ModFluffBlocks.prismarineBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.redQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.reedStairs);
|
||||
registerItemModel(ModFluffBlocks.shimmerrockStairs);
|
||||
registerItemModel(ModFluffBlocks.shimmerwoodPlankStairs);
|
||||
registerItemModel(ModFluffBlocks.snowBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.soulBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.sunnyQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.thatchStairs);
|
||||
registerItemModel(ModFluffBlocks.tileStairs);
|
||||
}
|
||||
|
||||
private static void registerSlabs() {
|
||||
for (Block b : ModFluffBlocks.biomeStoneSlabs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.pavementSlabs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.stoneSlabs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
registerItemModel(ModFluffBlocks.livingwoodSlab);
|
||||
registerItemModel(ModFluffBlocks.livingwoodPlankSlab);
|
||||
registerItemModel(ModFluffBlocks.livingrockSlab);
|
||||
registerItemModel(ModFluffBlocks.livingrockBrickSlab);
|
||||
|
||||
registerItemModel(ModFluffBlocks.blazeQuartzSlab);
|
||||
if (ConfigHandler.darkQuartzEnabled)
|
||||
registerItemModel(ModFluffBlocks.darkQuartzSlab);
|
||||
registerItemModel(ModFluffBlocks.elfQuartzSlab);
|
||||
registerItemModel(ModFluffBlocks.lavenderQuartzSlab);
|
||||
registerItemModel(ModFluffBlocks.manaQuartzSlab);
|
||||
registerItemModel(ModFluffBlocks.redQuartzSlab);
|
||||
registerItemModel(ModFluffBlocks.sunnyQuartzSlab);
|
||||
|
||||
registerItemModel(ModFluffBlocks.dreamwoodSlab);
|
||||
registerItemModel(ModFluffBlocks.dreamwoodPlankSlab);
|
||||
registerItemModel(ModFluffBlocks.prismarineSlab);
|
||||
registerItemModel(ModFluffBlocks.prismarineBrickSlab);
|
||||
registerItemModel(ModFluffBlocks.darkPrismarineSlab);
|
||||
registerItemModel(ModFluffBlocks.dirtPathSlab);
|
||||
registerItemModel(ModFluffBlocks.shimmerrockSlab);
|
||||
registerItemModel(ModFluffBlocks.shimmerwoodPlankSlab);
|
||||
registerItemModel(ModFluffBlocks.endStoneSlab);
|
||||
registerItemModel(ModFluffBlocks.enderBrickSlab);
|
||||
registerItemModel(ModFluffBlocks.netherBrickSlab);
|
||||
registerItemModel(ModFluffBlocks.soulBrickSlab);
|
||||
registerItemModel(ModFluffBlocks.snowBrickSlab);
|
||||
registerItemModel(ModFluffBlocks.tileSlab);
|
||||
registerItemModel(ModFluffBlocks.reedSlab);
|
||||
registerItemModel(ModFluffBlocks.thatchSlab);
|
||||
|
||||
}
|
||||
|
||||
private static void registerWalls() {
|
||||
Item item = Item.getItemFromBlock(ModFluffBlocks.biomeStoneWall);
|
||||
for (BiomeStoneVariant variant : BotaniaStateProps.BIOMESTONEWALL_VARIANT.getAllowedValues()) {
|
||||
String variantName = "inventory_" + variant.getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, variant.ordinal() - 8, new ModelResourceLocation("botania:biomeStoneA0Wall", variantName));
|
||||
}
|
||||
|
||||
item = Item.getItemFromBlock(ModFluffBlocks.stoneWall);
|
||||
for (FutureStoneVariant variant : BotaniaStateProps.FUTURESTONEWALL_VARIANT.getAllowedValues()) {
|
||||
String variantName = "inventory_" + variant.getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, variant.ordinal(), new ModelResourceLocation("botania:stone0Wall", variantName));
|
||||
}
|
||||
|
||||
registerItemModel(ModFluffBlocks.livingrockWall);
|
||||
registerItemModel(ModFluffBlocks.livingwoodWall);
|
||||
registerItemModel(ModFluffBlocks.dreamwoodWall);
|
||||
registerItemModel(ModFluffBlocks.prismarineWall);
|
||||
registerItemModel(ModFluffBlocks.reedWall);
|
||||
}
|
||||
|
||||
private static void registerPanes() {
|
||||
registerItemModel(ModFluffBlocks.alfglassPane);
|
||||
registerItemModel(ModFluffBlocks.bifrostPane);
|
||||
registerItemModel(ModFluffBlocks.managlassPane);
|
||||
}
|
||||
|
||||
private static void registerAltars() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.altar);
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.altar).toString();
|
||||
for (int i = 0; i < AltarVariant.values().length - 1; i++) { // Off by one on purpose to exclude MOSSY
|
||||
String variantName = "variant=" + AltarVariant.values()[i].getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, variantName));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerQuartzBlocks() {
|
||||
for (Block b : Lists.newArrayList(ModFluffBlocks.blazeQuartz, ModFluffBlocks.darkQuartz, ModFluffBlocks.elfQuartz, ModFluffBlocks.lavenderQuartz, ModFluffBlocks.manaQuartz, ModFluffBlocks.redQuartz, ModFluffBlocks.sunnyQuartz)) {
|
||||
if (b == null) // Dark quartz disabled
|
||||
continue;
|
||||
Item item = Item.getItemFromBlock(b);
|
||||
String name = ForgeRegistries.BLOCKS.getKey(b).toString();
|
||||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(name, "variant=normal"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(name, "variant=chiseled"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 2, new ModelResourceLocation(name, "variant=pillar_y"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerLuminizers() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.lightRelay);
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.lightRelay).toString();
|
||||
for (LuminizerVariant v : LuminizerVariant.values()) {
|
||||
ModelLoader.setCustomModelResourceLocation(item, v.ordinal(), new ModelResourceLocation(name, "powered=false,variant=" + v.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
private static <T extends Enum<T> & IStringSerializable> void registerVariantsDefaulted(Block b, Class<T> enumclazz, String variantHeader) {
|
||||
public static void registerCustomItemblock(Block b, int maxExclusive, IntFunction<String> metaToPath) {
|
||||
Item item = Item.getItemFromBlock(b);
|
||||
for (T e : enumclazz.getEnumConstants()) {
|
||||
String baseName = ForgeRegistries.BLOCKS.getKey(b).toString();
|
||||
String variantName = variantHeader + "=" + e.getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, e.ordinal(), new ModelResourceLocation(baseName, variantName));
|
||||
for (int i = 0; i < maxExclusive; i++) {
|
||||
ModelLoader.setCustomModelResourceLocation(
|
||||
item, i,
|
||||
new ModelResourceLocation(LibMisc.MOD_ID + ":itemblock/" + metaToPath.apply(i), "inventory")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers all metas of the given item to models/item/registryname.json
|
||||
*/
|
||||
private static void registerItemModelAllMeta(Item item, int range) {
|
||||
String loc = ForgeRegistries.ITEMS.getKey(item).toString();
|
||||
for(int i = 0; i < range; i++) {
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(loc, "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(loc, "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers each meta of an item to models/item/registryname<meta>.json
|
||||
* Range is exclusive upper bound
|
||||
*/
|
||||
private static void registerItemModelMetas(Item item, String loc, int range) {
|
||||
for(int i = 0; i < range; i++) {
|
||||
String name = "botania:" + loc + i;
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerItemModel(Block b) {
|
||||
registerItemModel(Item.getItemFromBlock(b));
|
||||
}
|
||||
|
||||
private static void registerItemModel(Item i,int meta) {
|
||||
ResourceLocation loc = i.getRegistryName();
|
||||
ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, "inventory"));
|
||||
}
|
||||
|
||||
private static void registerItemModel(Item i) {
|
||||
registerItemModel(i, 0);
|
||||
}
|
||||
|
||||
private ModelHandler() {}
|
||||
|
||||
private interface MesherWrapper extends ItemMeshDefinition {
|
||||
|
||||
static MesherWrapper of(MesherWrapper w) {
|
||||
return w;
|
||||
}
|
||||
|
||||
ModelResourceLocation getLocation(ItemStack stack);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
default ModelResourceLocation getModelLocation(@Nonnull ItemStack stack) {
|
||||
return getLocation(stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -85,17 +85,12 @@ public class MultiblockBlockAccess implements IBlockAccess {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Biome getBiomeGenForCoords(@Nonnull BlockPos pos) {
|
||||
public Biome getBiome(@Nonnull BlockPos pos) {
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.getBiomeGenForCoords(pos);
|
||||
return originalBlockAccess.getBiome(pos);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean extendedLevelsInChunkCache() {
|
||||
return hasBlockAccess && originalBlockAccess.extendedLevelsInChunkCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(@Nonnull BlockPos pos, @Nonnull EnumFacing side, boolean _default) {
|
||||
if(hasBlockAccess)
|
||||
|
||||
@@ -40,6 +40,8 @@ import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public final class MultiblockRenderHandler {
|
||||
|
||||
private MultiblockRenderHandler() {}
|
||||
|
||||
private static final MultiblockBlockAccess blockAccess = new MultiblockBlockAccess();
|
||||
private static int dimension;
|
||||
|
||||
@@ -79,7 +81,7 @@ public final class MultiblockRenderHandler {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(mc.thePlayer != null && mc.objectMouseOver != null && mc.objectMouseOver.getBlockPos() != null && (!mc.thePlayer.isSneaking() || anchor != null)) {
|
||||
renderPlayerLook(mc.thePlayer, mc.objectMouseOver);
|
||||
@@ -87,7 +89,7 @@ public final class MultiblockRenderHandler {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
|
||||
public static void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
|
||||
if(currentMultiblock != null && anchor == null && event.getEntityPlayer() == Minecraft.getMinecraft().thePlayer) {
|
||||
anchor = event.getPos();
|
||||
angle = event.getEntityPlayer().getHorizontalFacing();
|
||||
@@ -95,7 +97,7 @@ public final class MultiblockRenderHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPlayerLook(EntityPlayer player, RayTraceResult src) {
|
||||
private static void renderPlayerLook(EntityPlayer player, RayTraceResult src) {
|
||||
if(currentMultiblock != null && dimension == player.worldObj.provider.getDimension()) {
|
||||
BlockPos anchorPos = anchor != null ? anchor : src.getBlockPos();
|
||||
|
||||
@@ -133,7 +135,7 @@ public final class MultiblockRenderHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean renderComponentInWorld(World world, Multiblock mb, MultiblockComponent comp, BlockPos anchorPos) {
|
||||
private static boolean renderComponentInWorld(World world, Multiblock mb, MultiblockComponent comp, BlockPos anchorPos) {
|
||||
double renderPosX, renderPosY, renderPosZ;
|
||||
|
||||
try {
|
||||
|
||||
@@ -12,11 +12,14 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderSpecificHandEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.lwjgl.util.glu.Project;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
@@ -30,114 +33,59 @@ import vazkii.botania.common.item.ModItems;
|
||||
// Hacky way to render 3D lexicon, will be reevaluated in the future.
|
||||
public class RenderLexicon {
|
||||
|
||||
final ModelBook model = new ModelBook();
|
||||
final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_LEXICA);
|
||||
private final ModelBook model = new ModelBook();
|
||||
private final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_LEXICA);
|
||||
|
||||
@SubscribeEvent
|
||||
public void renderItem(RenderHandEvent evt) {
|
||||
Minecraft mc;
|
||||
if(true || !ConfigHandler.lexicon3dModel || mc.gameSettings.thirdPersonView != 0 || !PlayerHelper.hasHeldItem(mc.thePlayer, ModItems.lexicon))
|
||||
public void renderItem(RenderSpecificHandEvent evt) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(!ConfigHandler.lexicon3dModel
|
||||
|| mc.gameSettings.thirdPersonView != 0
|
||||
|| mc.thePlayer.getHeldItem(evt.getHand()) == null
|
||||
|| mc.thePlayer.getHeldItem(evt.getHand()).getItem() != ModItems.lexicon)
|
||||
return;
|
||||
evt.setCanceled(true);
|
||||
|
||||
try {
|
||||
// Called immediately before EntityRenderer.renderHand
|
||||
GlStateManager.clear(256);
|
||||
// Begin copy EntityRenderer.renderHand
|
||||
GlStateManager.matrixMode(5889);
|
||||
GlStateManager.loadIdentity();
|
||||
float f = 0.07F;
|
||||
|
||||
if (mc.gameSettings.anaglyph)
|
||||
{
|
||||
GlStateManager.translate((float)(-(/*xOffset*/0 * 2 - 1)) * f, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
float fovModifier = ((float) ClientMethodHandles.getFOVModifier.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks, false));
|
||||
float farPlane = ((float) ClientMethodHandles.farPlaneDistance_getter.invokeExact(mc.entityRenderer));
|
||||
Project.gluPerspective(fovModifier, (float)mc.displayWidth / (float)mc.displayHeight, 0.05F, farPlane * 2.0F);
|
||||
GlStateManager.matrixMode(5888);
|
||||
GlStateManager.loadIdentity();
|
||||
|
||||
if (mc.gameSettings.anaglyph)
|
||||
{
|
||||
GlStateManager.translate((float)(/*xOffset*/0 * 2 - 1) * 0.1F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
ClientMethodHandles.hurtCameraEffect.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
|
||||
|
||||
if (mc.gameSettings.viewBobbing)
|
||||
{
|
||||
ClientMethodHandles.setupViewBobbing.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
|
||||
}
|
||||
|
||||
boolean flag = mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)mc.getRenderViewEntity()).isPlayerSleeping();
|
||||
|
||||
if (mc.gameSettings.thirdPersonView == 0 && !flag && !mc.gameSettings.hideGUI && !mc.playerController.isSpectator())
|
||||
{
|
||||
ClientMethodHandles.enableLightmap.invokeExact(mc.entityRenderer);
|
||||
renderItemInFirstPerson();
|
||||
ClientMethodHandles.disableLightmap.invokeExact(mc.entityRenderer);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if (mc.gameSettings.thirdPersonView == 0 && !flag)
|
||||
{
|
||||
mc.getItemRenderer().renderOverlays(ClientTickHandler.partialTicks);
|
||||
ClientMethodHandles.hurtCameraEffect.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
|
||||
}
|
||||
|
||||
if (mc.gameSettings.viewBobbing)
|
||||
{
|
||||
ClientMethodHandles.setupViewBobbing.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
|
||||
}
|
||||
// End EntityRenderer.renderHand copy
|
||||
renderItemInFirstPerson(mc.thePlayer, evt.getPartialTicks(), evt.getInterpolatedPitch(), evt.getHand(), evt.getSwingProgress(), evt.getItemStack(), evt.getEquipProgress());
|
||||
} catch (Throwable throwable) {
|
||||
Botania.LOGGER.warn("Failed to render lexicon");
|
||||
}
|
||||
}
|
||||
|
||||
private void renderItemInFirstPerson() throws Throwable {
|
||||
private void renderItemInFirstPerson(AbstractClientPlayer player, float partialTicks, float interpPitch, EnumHand hand, float swingProgress, ItemStack stack, float equipProgress) throws Throwable {
|
||||
// Cherry picked from ItemRenderer.renderItemInFirstPerson
|
||||
float prevEquippedProgress = 0;//((float) ClientMethodHandles.prevEquippedProgress_getter.invokeExact(Minecraft.getMinecraft().getItemRenderer()));
|
||||
float equippedProgress = 0;//((float) ClientMethodHandles.equippedProgress_getter.invokeExact(Minecraft.getMinecraft().getItemRenderer()));
|
||||
float f = 1.0F - (prevEquippedProgress + (equippedProgress - prevEquippedProgress) * ClientTickHandler.partialTicks);
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
|
||||
float f1 = player.getSwingProgress(ClientTickHandler.partialTicks);
|
||||
float f2 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * ClientTickHandler.partialTicks;
|
||||
float f3 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * ClientTickHandler.partialTicks;
|
||||
this.func_178101_a(f2, f3);
|
||||
this.func_178109_a(player);
|
||||
this.func_178110_a(player, ClientTickHandler.partialTicks);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
boolean flag = hand == EnumHand.MAIN_HAND;
|
||||
EnumHandSide enumhandside = flag ? player.getPrimaryHand() : player.getPrimaryHand().opposite();
|
||||
GlStateManager.pushMatrix();
|
||||
this.func_178105_d(f1);
|
||||
this.transformFirstPersonItem(f, f1);
|
||||
|
||||
doRender();
|
||||
|
||||
boolean flag1 = enumhandside == EnumHandSide.RIGHT;
|
||||
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI);
|
||||
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(swingProgress) * ((float)Math.PI * 2F));
|
||||
float f2 = -0.2F * MathHelper.sin(swingProgress * (float)Math.PI);
|
||||
int i = flag1 ? 1 : -1;
|
||||
GlStateManager.translate((float)i * f, f1, f2);
|
||||
this.transformSideFirstPerson(enumhandside, equipProgress);
|
||||
this.transformFirstPerson(enumhandside, swingProgress);
|
||||
doRender(enumhandside, partialTicks, stack);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
private void doRender() {
|
||||
private void doRender(EnumHandSide side, float partialTicks, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
float opening;
|
||||
float pageFlip;
|
||||
|
||||
float ticks = ClientTickHandler.ticksWithLexicaOpen;
|
||||
if(ticks > 0 && ticks < 10) {
|
||||
if(Minecraft.getMinecraft().currentScreen instanceof GuiLexicon)
|
||||
ticks += ClientTickHandler.partialTicks;
|
||||
else ticks -= ClientTickHandler.partialTicks;
|
||||
ticks += partialTicks;
|
||||
else ticks -= partialTicks;
|
||||
}
|
||||
|
||||
GlStateManager.translate(0.3F + 0.02F * ticks, 0.475F + 0.01F * ticks, -0.2F - 0.01F * ticks);
|
||||
GlStateManager.rotate(87.5F + ticks * 5, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(87.5F + ticks * (side == EnumHandSide.RIGHT ? 5 : 10), 0F, 1F, 0F);
|
||||
GlStateManager.rotate(ticks * 2.85F, 0F, 0F, 1F);
|
||||
opening = ticks / 12F;
|
||||
|
||||
@@ -153,13 +101,12 @@ public class RenderLexicon {
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.translate(-0.3F, -0.21F, -0.07F);
|
||||
GlStateManager.scale(0.0035F, 0.0035F, -0.0035F);
|
||||
boolean bevo = Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase("BevoLJ");
|
||||
boolean saice = Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase("saice");
|
||||
boolean bevo = mc.thePlayer.getName().equalsIgnoreCase("BevoLJ");
|
||||
boolean saice = mc.thePlayer.getName().equalsIgnoreCase("saice");
|
||||
|
||||
String title = ModItems.lexicon.getItemStackDisplayName(null);
|
||||
String origTitle = title;
|
||||
|
||||
ItemStack stack = PlayerHelper.getFirstHeldItemClass(Minecraft.getMinecraft().thePlayer, Item.class);
|
||||
if(stack != null)
|
||||
title = stack.getDisplayName();
|
||||
if(title.equals(origTitle) && bevo)
|
||||
@@ -188,56 +135,37 @@ public class RenderLexicon {
|
||||
GlStateManager.translate(0F, 10F, 0F);
|
||||
font.drawString(I18n.format("botaniamisc.lexiconcover" + (bevo ? 4 : 5)), 0, 0, 0x79ff92);
|
||||
}
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
// Copy - ItemRenderer.func_178101_a
|
||||
private void func_178101_a(float angle, float p_178101_2_) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(angle, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(p_178101_2_, 0.0F, 1.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GlStateManager.popMatrix();
|
||||
// Copy - ItemRenderer.transformSideFirstPerson
|
||||
// Arg - Side, EquipProgress
|
||||
private void transformSideFirstPerson(EnumHandSide p_187459_1_, float p_187459_2_)
|
||||
{
|
||||
int i = p_187459_1_ == EnumHandSide.RIGHT ? 1 : -1;
|
||||
GlStateManager.translate((float)i * 0.56F, -0.52F + p_187459_2_ * -0.6F, -0.72F);
|
||||
}
|
||||
|
||||
// Copy - ItemRenderer.func_178109_a
|
||||
private void func_178109_a(AbstractClientPlayer clientPlayer) {
|
||||
int i = Minecraft.getMinecraft().theWorld.getCombinedLight(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ), 0);
|
||||
float f = (float)(i & 65535);
|
||||
float f1 = (float)(i >> 16);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1);
|
||||
}
|
||||
|
||||
// Copy - ItemRenderer.func_178110_a
|
||||
private void func_178110_a(EntityPlayerSP entityplayerspIn, float partialTicks) {
|
||||
float f = entityplayerspIn.prevRenderArmPitch + (entityplayerspIn.renderArmPitch - entityplayerspIn.prevRenderArmPitch) * partialTicks;
|
||||
float f1 = entityplayerspIn.prevRenderArmYaw + (entityplayerspIn.renderArmYaw - entityplayerspIn.prevRenderArmYaw) * partialTicks;
|
||||
GlStateManager.rotate((entityplayerspIn.rotationPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate((entityplayerspIn.rotationYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
// Copy - ItemRenderer.func_178105_d
|
||||
private void func_178105_d(float p_178105_1_) {
|
||||
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178105_1_) * (float)Math.PI);
|
||||
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(p_178105_1_) * (float)Math.PI * 2.0F);
|
||||
float f2 = -0.2F * MathHelper.sin(p_178105_1_ * (float)Math.PI);
|
||||
GlStateManager.translate(f, f1, f2);
|
||||
}
|
||||
|
||||
// Copy with modification - ItemRenderer.transformFirstPersonItem
|
||||
private void transformFirstPersonItem(float equipProgress, float swingProgress) {
|
||||
GlStateManager.translate(1.2F, -1F, -0.71999997F); // Botania - x(0.56) -> 1; y(-0.52) -> -1
|
||||
GlStateManager.translate(0.0F, equipProgress * -0.6F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); // Botania - 45 -> 90
|
||||
GlStateManager.rotate(-20, 0, 0, 1); // Botania - added
|
||||
float f = MathHelper.sin(swingProgress * swingProgress * (float)Math.PI);
|
||||
float f1 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI);
|
||||
GlStateManager.rotate(f * -20.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotate(f1 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
// Copy with modification - ItemRenderer.transformFirstPerson
|
||||
// Arg - Side, SwingProgress
|
||||
private void transformFirstPerson(EnumHandSide p_187453_1_, float p_187453_2_)
|
||||
{
|
||||
int i = p_187453_1_ == EnumHandSide.RIGHT ? 1 : -1;
|
||||
// Botania - added
|
||||
GlStateManager.translate(p_187453_1_ == EnumHandSide.RIGHT ? 0.5F : 0.3F, -0.25F, 0.2F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(12F, 0F, 0F, -1F);
|
||||
// End add
|
||||
float f = MathHelper.sin(p_187453_2_ * p_187453_2_ * (float)Math.PI);
|
||||
GlStateManager.rotate((float)i * (45.0F + f * -20.0F), 0.0F, 1.0F, 0.0F);
|
||||
float f1 = MathHelper.sin(MathHelper.sqrt_float(p_187453_2_) * (float)Math.PI);
|
||||
GlStateManager.rotate((float)i * f1 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F);
|
||||
// GlStateManager.scale(0.4F, 0.4F, 0.4F); Botania - removed
|
||||
GlStateManager.rotate((float)i * -45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,8 +34,10 @@ import java.awt.*;
|
||||
|
||||
public final class SubTileRadiusRenderHandler {
|
||||
|
||||
private SubTileRadiusRenderHandler() {}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
RayTraceResult pos = mc.objectMouseOver;
|
||||
|
||||
@@ -79,7 +81,7 @@ public final class SubTileRadiusRenderHandler {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void renderRectangle(AxisAlignedBB aabb) {
|
||||
private static void renderRectangle(AxisAlignedBB aabb) {
|
||||
double renderPosX, renderPosY, renderPosZ;
|
||||
|
||||
try {
|
||||
@@ -124,7 +126,7 @@ public final class SubTileRadiusRenderHandler {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void renderCircle(BlockPos center, double radius) {
|
||||
private static void renderCircle(BlockPos center, double radius) {
|
||||
double renderPosX, renderPosY, renderPosZ;
|
||||
|
||||
try {
|
||||
|
||||
+98
-124
@@ -25,6 +25,8 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.event.RenderTooltipEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -47,133 +49,105 @@ public final class TooltipAdditionDisplayHandler {
|
||||
|
||||
private static float lexiconLookupTime = 0F;
|
||||
|
||||
public static void render() {
|
||||
@SubscribeEvent
|
||||
public static void onToolTipRender(RenderTooltipEvent.PostText evt) {
|
||||
if(evt.getStack() == null)
|
||||
return;
|
||||
|
||||
ItemStack stack = evt.getStack();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GuiScreen gui = mc.currentScreen;
|
||||
if(gui != null && gui instanceof GuiContainer && mc.thePlayer != null && mc.thePlayer.inventory.getItemStack() == null) {
|
||||
GuiContainer container = (GuiContainer) gui;
|
||||
Slot slot = container.getSlotUnderMouse();
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
if(stack != null) {
|
||||
ScaledResolution res = new ScaledResolution(mc);
|
||||
FontRenderer font = mc.fontRendererObj;
|
||||
int mouseX = Mouse.getX() * res.getScaledWidth() / mc.displayWidth;
|
||||
int mouseY = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / mc.displayHeight;
|
||||
int width = evt.getWidth();
|
||||
int height = 3;
|
||||
int tooltipX = evt.getX();
|
||||
int tooltipY = evt.getY() - 4;
|
||||
FontRenderer font = evt.getFontRenderer();
|
||||
|
||||
List<String> tooltip;
|
||||
try {
|
||||
tooltip = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
|
||||
} catch(Exception e) {
|
||||
tooltip = new ArrayList<>();
|
||||
if(stack.getItem() instanceof ItemTerraPick)
|
||||
drawTerraPick(stack, tooltipX, tooltipY, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay)
|
||||
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), tooltipX, tooltipY, width, height);
|
||||
|
||||
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
|
||||
if(data != null) {
|
||||
int lexSlot = -1;
|
||||
ItemStack lexiconStack = null;
|
||||
|
||||
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
|
||||
ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i);
|
||||
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
|
||||
lexiconStack = stackAt;
|
||||
lexSlot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(lexSlot > -1) {
|
||||
int x = tooltipX - 34;
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
Gui.drawRect(x - 4, tooltipY - 4, x + 20, tooltipY + 26, 0x44000000);
|
||||
Gui.drawRect(x - 6, tooltipY - 6, x + 22, tooltipY + 28, 0x44000000);
|
||||
|
||||
if(ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) {
|
||||
lexiconLookupTime += ClientTickHandler.delta;
|
||||
|
||||
int cx = x + 8;
|
||||
int cy = tooltipY + 8;
|
||||
float r = 12;
|
||||
float time = 20F;
|
||||
float angles = lexiconLookupTime / time * 360F;
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
VertexBuffer buf = Tessellator.getInstance().getBuffer();
|
||||
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
|
||||
|
||||
float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F);
|
||||
buf.pos(cx, cy, 0).color(0F, 0.5F, 0F, a).endVertex();
|
||||
|
||||
for(float i = angles; i > 0; i--) {
|
||||
double rad = (i - 90) / 180F * Math.PI;
|
||||
buf.pos(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r, 0).color(0F, 1F, 0F, 1F).endVertex();
|
||||
}
|
||||
int width = 0;
|
||||
for(String s : tooltip)
|
||||
width = Math.max(width, font.getStringWidth(s) + 2);
|
||||
int tooltipHeight = (tooltip.size() - 1) * 10 + 5;
|
||||
|
||||
int height = 3;
|
||||
int offx = 11;
|
||||
int offy = 17;
|
||||
buf.pos(cx, cy, 0).color(0F, 1F, 0F, 0F).endVertex();
|
||||
Tessellator.getInstance().draw();
|
||||
|
||||
boolean offscreen = mouseX + width + 19 >= res.getScaledWidth();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
|
||||
int fixY = res.getScaledHeight() - (mouseY + tooltipHeight);
|
||||
if(fixY < 0)
|
||||
offy -= fixY;
|
||||
if(offscreen)
|
||||
offx = -13 - width;
|
||||
if(lexiconLookupTime >= time) {
|
||||
mc.thePlayer.inventory.currentItem = lexSlot;
|
||||
Botania.proxy.setEntryToOpen(data.entry);
|
||||
Botania.proxy.setLexiconStack(lexiconStack);
|
||||
mc.thePlayer.closeScreen();
|
||||
ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false);
|
||||
|
||||
if(stack.getItem() instanceof ItemTerraPick)
|
||||
drawTerraPick(stack, mouseX, mouseY, offx, offy, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay)
|
||||
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), mouseX, mouseY, offx, offy, width, height);
|
||||
|
||||
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
|
||||
if(data != null) {
|
||||
int lexSlot = -1;
|
||||
ItemStack lexiconStack = null;
|
||||
|
||||
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
|
||||
ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i);
|
||||
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
|
||||
lexiconStack = stackAt;
|
||||
lexSlot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(lexSlot > -1) {
|
||||
int x = mouseX + offx - 34;
|
||||
int y = mouseY - offy;
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
Gui.drawRect(x - 4, y - 4, x + 20, y + 26, 0x44000000);
|
||||
Gui.drawRect(x - 6, y - 6, x + 22, y + 28, 0x44000000);
|
||||
|
||||
if(ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) {
|
||||
lexiconLookupTime += ClientTickHandler.delta;
|
||||
|
||||
int cx = x + 8;
|
||||
int cy = y + 8;
|
||||
float r = 12;
|
||||
float time = 20F;
|
||||
float angles = lexiconLookupTime / time * 360F;
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
VertexBuffer buf = Tessellator.getInstance().getBuffer();
|
||||
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
|
||||
|
||||
float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F);
|
||||
buf.pos(cx, cy, 0).color(0F, 0.5F, 0F, a).endVertex();
|
||||
|
||||
for(float i = angles; i > 0; i--) {
|
||||
double rad = (i - 90) / 180F * Math.PI;
|
||||
buf.pos(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r, 0).color(0F, 1F, 0F, 1F).endVertex();
|
||||
}
|
||||
|
||||
buf.pos(cx, cy, 0).color(0F, 1F, 0F, 0F).endVertex();
|
||||
Tessellator.getInstance().draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
|
||||
if(lexiconLookupTime >= time) {
|
||||
mc.thePlayer.inventory.currentItem = lexSlot;
|
||||
Botania.proxy.setEntryToOpen(data.entry);
|
||||
Botania.proxy.setLexiconStack(lexiconStack);
|
||||
mc.thePlayer.closeScreen();
|
||||
ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false);
|
||||
|
||||
}
|
||||
} else lexiconLookupTime = 0F;
|
||||
|
||||
mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, y);
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
font.drawStringWithShadow("?", x + 10, y + 8, 0xFFFFFFFF);
|
||||
GlStateManager.scale(0.5F, 0.5F, 1F);
|
||||
boolean mac = Minecraft.IS_RUNNING_ON_MAC;
|
||||
|
||||
mc.fontRendererObj.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (y + 8) * 2 + 20, 0xFFFFFFFF);
|
||||
GlStateManager.scale(2F, 2F, 1F);
|
||||
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
} else lexiconLookupTime = 0F;
|
||||
} else lexiconLookupTime = 0F;
|
||||
}
|
||||
} else lexiconLookupTime = 0F;
|
||||
|
||||
mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, tooltipY);
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
font.drawStringWithShadow("?", x + 10, tooltipY + 8, 0xFFFFFFFF);
|
||||
GlStateManager.scale(0.5F, 0.5F, 1F);
|
||||
boolean mac = Minecraft.IS_RUNNING_ON_MAC;
|
||||
|
||||
mc.fontRendererObj.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (tooltipY + 8) * 2 + 20, 0xFFFFFFFF);
|
||||
GlStateManager.scale(2F, 2F, 1F);
|
||||
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
} else lexiconLookupTime = 0F;
|
||||
} else lexiconLookupTime = 0F;
|
||||
}
|
||||
|
||||
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
|
||||
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int width, int height, FontRenderer font) {
|
||||
int level = ItemTerraPick.getLevel(stack);
|
||||
int max = ItemTerraPick.LEVELS[Math.min(ItemTerraPick.LEVELS.length - 1, level + 1)];
|
||||
boolean ss = level >= ItemTerraPick.LEVELS.length - 1;
|
||||
@@ -184,33 +158,33 @@ public final class TooltipAdditionDisplayHandler {
|
||||
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
|
||||
|
||||
GlStateManager.disableDepth();
|
||||
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
|
||||
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
|
||||
for(int i = 0; i < rainbowWidth; i++)
|
||||
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
Gui.drawRect(mouseX + i, mouseY - height, mouseX + i + 1, mouseY, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
Gui.drawRect(mouseX + rainbowWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
|
||||
|
||||
String rank = I18n.format("botania.rank" + level).replaceAll("&", "\u00a7");
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableLighting();
|
||||
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
|
||||
font.drawStringWithShadow(rank, mouseX, mouseY - 12, 0xFFFFFF);
|
||||
if(!ss) {
|
||||
rank = I18n.format("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
|
||||
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF);
|
||||
font.drawStringWithShadow(rank, mouseX + width - font.getStringWidth(rank), mouseY - 12, 0xFFFFFF);
|
||||
}
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepth();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int offx, int offy, int width, int height) {
|
||||
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int width, int height) {
|
||||
float fraction = display.getManaFractionForDisplay(stack);
|
||||
int manaBarWidth = (int) Math.ceil(width * fraction);
|
||||
|
||||
GlStateManager.disableDepth();
|
||||
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
|
||||
Gui.drawRect(mouseX + offx, mouseY - offy - height, mouseX + offx + manaBarWidth, mouseY - offy, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
|
||||
Gui.drawRect(mouseX + offx + manaBarWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
|
||||
Gui.drawRect(mouseX, mouseY - height, mouseX + manaBarWidth, mouseY, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
|
||||
Gui.drawRect(mouseX + manaBarWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,13 +23,7 @@ import vazkii.botania.common.item.ItemRegenIvy;
|
||||
public final class TooltipHandler {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void onTooltipEvent(ItemTooltipEvent event) {
|
||||
if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.DIRT) && event.getItemStack().getItemDamage() == 1) {
|
||||
event.getToolTip().add(I18n.format("botaniamisc.coarseDirt0"));
|
||||
event.getToolTip().add(I18n.format("botaniamisc.coarseDirt1"));
|
||||
} else if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.MOB_SPAWNER) && event.getEntityPlayer().capabilities.isCreativeMode)
|
||||
event.getToolTip().add(I18n.format("botaniamisc.spawnerTip"));
|
||||
|
||||
public static void onTooltipEvent(ItemTooltipEvent event) {
|
||||
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemRegenIvy.TAG_REGEN, false))
|
||||
event.getToolTip().add(I18n.format("botaniamisc.hasIvy"));
|
||||
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false))
|
||||
|
||||
@@ -26,15 +26,16 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSettings.GameType;
|
||||
import net.minecraftforge.client.model.animation.AnimationTESR;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.api.item.IExtendedPlayerController;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -61,6 +62,7 @@ import vazkii.botania.client.core.handler.MultiblockRenderHandler;
|
||||
import vazkii.botania.client.core.handler.PersistentVariableHelper;
|
||||
import vazkii.botania.client.core.handler.RenderLexicon;
|
||||
import vazkii.botania.client.core.handler.SubTileRadiusRenderHandler;
|
||||
import vazkii.botania.client.core.handler.TooltipAdditionDisplayHandler;
|
||||
import vazkii.botania.client.core.handler.TooltipHandler;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.fx.FXLightning;
|
||||
@@ -137,7 +139,7 @@ import vazkii.botania.common.block.tile.string.TileRedString;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.core.proxy.CommonProxy;
|
||||
import vazkii.botania.common.core.proxy.IProxy;
|
||||
import vazkii.botania.common.core.version.AdaptorNotifier;
|
||||
import vazkii.botania.common.core.version.VersionChecker;
|
||||
import vazkii.botania.common.entity.EntityBabylonWeapon;
|
||||
@@ -165,7 +167,7 @@ import java.time.LocalDateTime;
|
||||
import java.time.Month;
|
||||
import java.util.Map;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
public class ClientProxy implements IProxy {
|
||||
|
||||
public static boolean jingleTheBells = false;
|
||||
public static boolean dootDoot = false;
|
||||
@@ -185,8 +187,6 @@ public class ClientProxy extends CommonProxy {
|
||||
Botania.LOGGER.fatal("Persistent Variables couldn't load!!");
|
||||
}
|
||||
|
||||
super.preInit(event);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(MiscellaneousIcons.INSTANCE);
|
||||
ModelHandler.registerModels();
|
||||
initRenderers();
|
||||
@@ -194,30 +194,30 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
super.init(event);
|
||||
ColorHandler.init();
|
||||
initAuxiliaryRender();
|
||||
|
||||
ModChallenges.init();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new ClientTickHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new HUDHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new LightningHandler());
|
||||
MinecraftForge.EVENT_BUS.register(ClientTickHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(HUDHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(LightningHandler.class);
|
||||
if(ConfigHandler.boundBlockWireframe)
|
||||
MinecraftForge.EVENT_BUS.register(new BoundTileRenderer());
|
||||
MinecraftForge.EVENT_BUS.register(new TooltipHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new DebugHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SubTileRadiusRenderHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockRenderHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SkyblockRenderEvents());
|
||||
MinecraftForge.EVENT_BUS.register(BoundTileRenderer.class);
|
||||
MinecraftForge.EVENT_BUS.register(TooltipHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(TooltipAdditionDisplayHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(DebugHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(SubTileRadiusRenderHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(MultiblockRenderHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(SkyblockRenderEvents.class);
|
||||
MinecraftForge.EVENT_BUS.register(new RenderLexicon());
|
||||
MinecraftForge.EVENT_BUS.register(new BossBarHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new BergamuteEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(BossBarHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(BergamuteEventHandler.class);
|
||||
|
||||
if(ConfigHandler.useAdaptativeConfig)
|
||||
MinecraftForge.EVENT_BUS.register(new AdaptorNotifier());
|
||||
MinecraftForge.EVENT_BUS.register(AdaptorNotifier.class);
|
||||
if(ConfigHandler.versionCheckEnabled)
|
||||
new VersionChecker().init();
|
||||
VersionChecker.init();
|
||||
|
||||
if(ConfigHandler.enableSeasonalFeatures) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -231,7 +231,6 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
super.postInit(event);
|
||||
CorporeaAutoCompleteHandler.updateItemList();
|
||||
}
|
||||
|
||||
@@ -328,7 +327,6 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void setExtraReach(EntityLivingBase entity, float reach) {
|
||||
super.setExtraReach(entity, reach);
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
if(entity == player) {
|
||||
@@ -337,7 +335,7 @@ public class ClientProxy extends CommonProxy {
|
||||
BotaniaPlayerController controller = new BotaniaPlayerController(mc, net);
|
||||
boolean isFlying = player.capabilities.isFlying;
|
||||
boolean allowFlying = player.capabilities.allowFlying;
|
||||
Botania.crossVersionProxy.copyGameType(mc.playerController, controller);
|
||||
controller.setGameType(mc.playerController.getCurrentGameType());
|
||||
player.capabilities.isFlying = isFlying;
|
||||
player.capabilities.allowFlying = allowFlying;
|
||||
mc.playerController = controller;
|
||||
@@ -434,11 +432,11 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
|
||||
if(!doParticle(world) && !fake)
|
||||
public void sparkleFX(double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
|
||||
if(!doParticle() && !fake)
|
||||
return;
|
||||
|
||||
FXSparkle sparkle = new FXSparkle(world, x, y, z, size, r, g, b, m);
|
||||
FXSparkle sparkle = new FXSparkle(Minecraft.getMinecraft().theWorld, x, y, z, size, r, g, b, m);
|
||||
sparkle.fake = sparkle.noClip = fake;
|
||||
if(noclipEnabled)
|
||||
sparkle.noClip = true;
|
||||
@@ -461,17 +459,17 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) {
|
||||
if(!doParticle(world))
|
||||
public void wispFX(double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) {
|
||||
if(!doParticle())
|
||||
return;
|
||||
|
||||
FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
|
||||
FXWisp wisp = new FXWisp(Minecraft.getMinecraft().theWorld, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
|
||||
wisp.setSpeed(motionx, motiony, motionz);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(wisp);
|
||||
}
|
||||
|
||||
private boolean doParticle(World world) {
|
||||
if(!world.isRemote)
|
||||
private boolean doParticle() {
|
||||
if(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
|
||||
return false;
|
||||
|
||||
if(!ConfigHandler.useVanillaParticleLimiter)
|
||||
@@ -487,8 +485,8 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lightningFX(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new FXLightning(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner));
|
||||
public void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new FXLightning(Minecraft.getMinecraft().theWorld, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@ import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.state.enums.AltarVariant;
|
||||
@@ -44,6 +45,9 @@ public class JEIBotaniaPlugin implements IModPlugin {
|
||||
public void register(@Nonnull IModRegistry registry) {
|
||||
IJeiHelpers jeiHelpers = registry.getJeiHelpers();
|
||||
|
||||
jeiHelpers.getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(ModBlocks.specialFlower), ItemBlockSpecialFlower::getType);
|
||||
jeiHelpers.getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(ModBlocks.floatingSpecialFlower), ItemBlockSpecialFlower::getType);
|
||||
|
||||
registry.addRecipeCategories(
|
||||
new BreweryRecipeCategory(jeiHelpers.getGuiHelper()),
|
||||
new PureDaisyRecipeCategory(jeiHelpers.getGuiHelper()),
|
||||
|
||||
+5
-2
@@ -106,8 +106,11 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
|
||||
posX += 18;
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(index, false, 93, 41);
|
||||
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
|
||||
for (int i = 0; i < wrapper.getOutputs().size(); i++) {
|
||||
ItemStack stack = wrapper.getOutputs().get(i);
|
||||
recipeLayout.getItemStacks().init(index + i, false, 93 + (i % 2 * 20), 41 + (i / 2 * 20));
|
||||
recipeLayout.getItemStacks().set(index + i, stack);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
private final List input;
|
||||
private final ItemStack output;
|
||||
private final List<ItemStack> outputs;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ElvenTradeRecipeWrapper(RecipeElvenTrade recipe) {
|
||||
@@ -36,7 +36,7 @@ public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
|
||||
}
|
||||
}
|
||||
input = builder.build();
|
||||
output = recipe.getOutput();
|
||||
outputs = ImmutableList.copyOf(recipe.getOutputs());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +46,7 @@ public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return ImmutableList.of(output);
|
||||
return outputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,10 @@ import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector3f;
|
||||
import javax.vecmath.Vector4f;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class FloatingFlowerModel implements IBakedModel {
|
||||
@@ -151,6 +154,7 @@ public class FloatingFlowerModel implements IBakedModel {
|
||||
private final IBakedModel flower;
|
||||
private final IBakedModel island;
|
||||
private final List<BakedQuad> genQuads;
|
||||
private final Map<EnumFacing, List<BakedQuad>> faceQuads = new EnumMap<>(EnumFacing.class);
|
||||
|
||||
public CompositeBakedModel(IBakedModel flower, IBakedModel island) {
|
||||
this.flower = flower;
|
||||
@@ -159,20 +163,20 @@ public class FloatingFlowerModel implements IBakedModel {
|
||||
ImmutableList.Builder<BakedQuad> genBuilder = ImmutableList.builder();
|
||||
final TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0F, 0.2F, 0F), null, new Vector3f(0.5F, 0.5F, 0.5F), null));
|
||||
|
||||
for(EnumFacing e : EnumFacing.VALUES)
|
||||
faceQuads.put(e, new ArrayList<>());
|
||||
|
||||
// Add flower quads, scaled and translated
|
||||
for(BakedQuad quad : flower.getQuads(null, null, 0)) {
|
||||
genBuilder.add(transform(quad, transform));
|
||||
}
|
||||
|
||||
flower.getQuads(null, null, 0).stream().map(q -> transform(q, transform)).forEach(genBuilder::add);
|
||||
for(EnumFacing e : EnumFacing.VALUES) {
|
||||
genBuilder.addAll(flower.getQuads(null, e, 0).stream().map(input -> transform(input, transform)).collect(Collectors.toList()));
|
||||
List<BakedQuad> faceQ = faceQuads.get(e);
|
||||
flower.getQuads(null, e, 0).stream().map(input -> transform(input, transform)).forEach(faceQ::add);
|
||||
}
|
||||
|
||||
// Add island quads
|
||||
genBuilder.addAll(island.getQuads(null, null, 0));
|
||||
for(EnumFacing e : EnumFacing.VALUES) {
|
||||
genBuilder.addAll(island.getQuads(null, e, 0));
|
||||
faceQuads.get(e).addAll(island.getQuads(null, e, 0));
|
||||
}
|
||||
|
||||
genQuads = genBuilder.build();
|
||||
@@ -180,7 +184,7 @@ public class FloatingFlowerModel implements IBakedModel {
|
||||
|
||||
// Forward all to flower model
|
||||
@Nonnull @Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) {
|
||||
return genQuads;
|
||||
return face == null ? genQuads : faceQuads.get(face);
|
||||
}
|
||||
@Override public boolean isAmbientOcclusion() {
|
||||
return flower.isAmbientOcclusion();
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.block.model.ModelManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
import net.minecraftforge.client.model.pipeline.VertexTransformer;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.item.ItemManaGun;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector3f;
|
||||
import javax.vecmath.Vector4f;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GunModel implements IBakedModel {
|
||||
|
||||
private final IBakedModel originalModel;
|
||||
|
||||
public GunModel(IBakedModel originalModel) {
|
||||
this.originalModel = Preconditions.checkNotNull(originalModel);
|
||||
}
|
||||
|
||||
private final ItemOverrideList itemHandler = new ItemOverrideList(ImmutableList.of()) {
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBakedModel handleItemState(@Nonnull IBakedModel model, ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase entity) {
|
||||
ItemStack lens = ItemManaGun.getLens(stack);
|
||||
if(lens != null) {
|
||||
IBakedModel lensModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(lens);
|
||||
return GunModel.this.getModel(lensModel);
|
||||
}
|
||||
else return GunModel.this;
|
||||
}
|
||||
};
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return itemHandler;
|
||||
}
|
||||
|
||||
@Nonnull @Override public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { return originalModel.getQuads(state, side, rand); }
|
||||
@Override public boolean isAmbientOcclusion() { return originalModel.isAmbientOcclusion(); }
|
||||
@Override public boolean isGui3d() { return originalModel.isGui3d(); }
|
||||
@Override public boolean isBuiltInRenderer() { return originalModel.isBuiltInRenderer(); }
|
||||
@Nonnull @Override public TextureAtlasSprite getParticleTexture() { return originalModel.getParticleTexture(); }
|
||||
@Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return originalModel.getItemCameraTransforms(); }
|
||||
|
||||
private final IdentityHashMap<IBakedModel, CompositeBakedModel> cache = new IdentityHashMap<>();
|
||||
|
||||
private CompositeBakedModel getModel(IBakedModel lens) {
|
||||
CompositeBakedModel model = cache.get(lens);
|
||||
if(model == null) {
|
||||
model = new CompositeBakedModel(lens, originalModel);
|
||||
cache.put(lens, model);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
protected static BakedQuad transform(BakedQuad quad, final TRSRTransformation transform) {
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.ITEM);
|
||||
final IVertexConsumer consumer = new VertexTransformer(builder) {
|
||||
@Override
|
||||
public void put(int element, float... data) {
|
||||
VertexFormatElement formatElement = DefaultVertexFormats.ITEM.getElement(element);
|
||||
switch(formatElement.getUsage()) {
|
||||
case POSITION: {
|
||||
float[] newData = new float[4];
|
||||
Vector4f vec = new Vector4f(data);
|
||||
transform.getMatrix().transform(vec);
|
||||
vec.get(newData);
|
||||
parent.put(element, newData);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
parent.put(element, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
quad.pipe(consumer);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private static class CompositeBakedModel implements IPerspectiveAwareModel {
|
||||
|
||||
private final IBakedModel gun;
|
||||
private final List<BakedQuad> genQuads;
|
||||
private final Map<EnumFacing, List<BakedQuad>> faceQuads = new EnumMap<>(EnumFacing.class);
|
||||
|
||||
CompositeBakedModel(IBakedModel lens, IBakedModel gun) {
|
||||
this.gun = gun;
|
||||
|
||||
ImmutableList.Builder<BakedQuad> genBuilder = ImmutableList.builder();
|
||||
final TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(-0.4F, 0.25F, 0), null, new Vector3f(0.625F, 0.625F, 0.625F), TRSRTransformation.quatFromXYZ(0, (float) Math.PI / 2, 0)));
|
||||
|
||||
for(EnumFacing e : EnumFacing.VALUES)
|
||||
faceQuads.put(e, new ArrayList<>());
|
||||
|
||||
// Add lens quads, scaled and translated
|
||||
for(BakedQuad quad : lens.getQuads(null, null, 0)) {
|
||||
genBuilder.add(transform(quad, transform));
|
||||
}
|
||||
|
||||
for(EnumFacing e : EnumFacing.VALUES) {
|
||||
faceQuads.get(e).addAll(lens.getQuads(null, e, 0).stream().map(input -> transform(input, transform)).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// Add gun quads
|
||||
genBuilder.addAll(gun.getQuads(null, null, 0));
|
||||
for(EnumFacing e : EnumFacing.VALUES) {
|
||||
faceQuads.get(e).addAll(gun.getQuads(null, e, 0));
|
||||
}
|
||||
|
||||
genQuads = genBuilder.build();
|
||||
|
||||
}
|
||||
|
||||
@Nonnull @Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) { return face == null ? genQuads : faceQuads.get(face); }
|
||||
|
||||
// Forward all to gun model
|
||||
@Override public boolean isAmbientOcclusion() { return gun.isAmbientOcclusion(); }
|
||||
@Override public boolean isGui3d() { return gun.isGui3d(); }
|
||||
@Override public boolean isBuiltInRenderer() { return gun.isBuiltInRenderer(); }
|
||||
@Nonnull @Override public TextureAtlasSprite getParticleTexture() { return gun.getParticleTexture();}
|
||||
@Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return gun.getItemCameraTransforms(); }
|
||||
@Nonnull @Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; }
|
||||
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
if(gun instanceof IPerspectiveAwareModel) {
|
||||
Pair<? extends IBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel) gun).handlePerspective(cameraTransformType);
|
||||
if(pair != null && pair.getRight() != null)
|
||||
return Pair.of(this, pair.getRight());
|
||||
}
|
||||
return Pair.of(this, TRSRTransformation.identity().getMatrix());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
@@ -25,20 +26,18 @@ public class LexiconModel implements IPerspectiveAwareModel {
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
IBakedModel original = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getModel(path);
|
||||
/*if(cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND && ConfigHandler.lexicon3dModel)
|
||||
return Pair.of(this, null); todo 1.9 */
|
||||
if((cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND
|
||||
|| cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND)
|
||||
&& ConfigHandler.lexicon3dModel)
|
||||
return Pair.of(this, null);
|
||||
return ((IPerspectiveAwareModel) original).handlePerspective(cameraTransformType);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) { return ImmutableList.of(); }
|
||||
@Nonnull @Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) { return ImmutableList.of(); }
|
||||
@Override public boolean isAmbientOcclusion() { return false; }
|
||||
@Override public boolean isGui3d() { return false; }
|
||||
@Override public boolean isBuiltInRenderer() { return false; }
|
||||
@Nonnull
|
||||
@Override public TextureAtlasSprite getParticleTexture() { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("botania:items/lexicon"); }
|
||||
@Nonnull
|
||||
@Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
|
||||
@Nonnull
|
||||
@Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; }
|
||||
@Nonnull @Override public TextureAtlasSprite getParticleTexture() { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("botania:items/lexicon"); }
|
||||
@Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
|
||||
@Nonnull @Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; }
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/**
|
||||
* This class was created by <wiiv>. It's 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
|
||||
*
|
||||
* File Created @ [? (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelBlackHoleCube extends ModelBase {
|
||||
public final ModelRenderer shape1;
|
||||
public final ModelRenderer shape1_1;
|
||||
public final ModelRenderer shape1_2;
|
||||
public final ModelRenderer shape1_3;
|
||||
public final ModelRenderer shape1_4;
|
||||
public final ModelRenderer shape1_5;
|
||||
public final ModelRenderer shape1_6;
|
||||
public final ModelRenderer shape1_7;
|
||||
public final ModelRenderer shape1_8;
|
||||
public final ModelRenderer shape1_9;
|
||||
public final ModelRenderer shape1_10;
|
||||
public final ModelRenderer shape1_11;
|
||||
|
||||
public ModelBlackHoleCube() {
|
||||
textureWidth = 36;
|
||||
textureHeight = 2;
|
||||
shape1_3 = new ModelRenderer(this, 0, 0);
|
||||
shape1_3.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_3.addBox(-7.0F, 7.0F, -8.0F, 14, 1, 1, 0.0F);
|
||||
setRotateAngle(shape1_3, 0.0F, 1.5707963267948966F, 0.0F);
|
||||
shape1_7 = new ModelRenderer(this, 0, 0);
|
||||
shape1_7.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_7.addBox(-7.0F, -8.0F, -8.0F, 14, 1, 1, 0.0F);
|
||||
setRotateAngle(shape1_7, 0.0F, 1.5707963267948966F, 0.0F);
|
||||
shape1_9 = new ModelRenderer(this, 0, 0);
|
||||
shape1_9.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_9.addBox(-7.0F, 7.0F, 7.0F, 14, 1, 1, 0.0F);
|
||||
setRotateAngle(shape1_9, 0.0F, 3.141592653589793F, 1.5707963267948966F);
|
||||
shape1_11 = new ModelRenderer(this, 0, 0);
|
||||
shape1_11.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_11.addBox(-7.0F, 7.0F, -8.0F, 14, 1, 1, 0.0F);
|
||||
setRotateAngle(shape1_11, 0.0F, 3.141592653589793F, 1.5707963267948966F);
|
||||
shape1 = new ModelRenderer(this, 0, 0);
|
||||
shape1.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1.addBox(-8.0F, 7.0F, 7.0F, 16, 1, 1, 0.0F);
|
||||
shape1_4 = new ModelRenderer(this, 0, 0);
|
||||
shape1_4.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_4.addBox(-8.0F, 7.0F, -8.0F, 16, 1, 1, 0.0F);
|
||||
shape1_8 = new ModelRenderer(this, 0, 0);
|
||||
shape1_8.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_8.addBox(-7.0F, -8.0F, -8.0F, 14, 1, 1, 0.0F);
|
||||
setRotateAngle(shape1_8, 0.0F, 3.141592653589793F, 1.5707963267948966F);
|
||||
shape1_2 = new ModelRenderer(this, 0, 0);
|
||||
shape1_2.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_2.addBox(-8.0F, -8.0F, -8.0F, 16, 1, 1, 0.0F);
|
||||
shape1_1 = new ModelRenderer(this, 0, 0);
|
||||
shape1_1.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_1.addBox(-8.0F, -8.0F, 7.0F, 16, 1, 1, 0.0F);
|
||||
shape1_6 = new ModelRenderer(this, 0, 0);
|
||||
shape1_6.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_6.addBox(-7.0F, -8.0F, -8.0F, 14, 1, 1, 0.0F);
|
||||
setRotateAngle(shape1_6, 0.0F, -1.5707963267948966F, 0.0F);
|
||||
shape1_10 = new ModelRenderer(this, 0, 0);
|
||||
shape1_10.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_10.addBox(-7.0F, -8.0F, 7.0F, 14, 1, 1, 0.0F);
|
||||
setRotateAngle(shape1_10, 0.0F, 3.141592653589793F, 1.5707963267948966F);
|
||||
shape1_5 = new ModelRenderer(this, 0, 0);
|
||||
shape1_5.setRotationPoint(0.0F, 16.0F, 0.0F);
|
||||
shape1_5.addBox(-7.0F, 7.0F, -8.0F, 14, 1, 1, 0.0F);
|
||||
setRotateAngle(shape1_5, 0.0F, -1.5707963267948966F, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
shape1_3.render(f5);
|
||||
shape1_7.render(f5);
|
||||
shape1_9.render(f5);
|
||||
shape1_11.render(f5);
|
||||
shape1.render(f5);
|
||||
shape1_4.render(f5);
|
||||
shape1_8.render(f5);
|
||||
shape1_2.render(f5);
|
||||
shape1_1.render(f5);
|
||||
shape1_6.render(f5);
|
||||
shape1_10.render(f5);
|
||||
shape1_5.render(f5);
|
||||
}
|
||||
|
||||
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -20,23 +21,29 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.util.ReportedException;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.Attributes;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.client.model.obj.OBJModel;
|
||||
import net.minecraftforge.client.model.pipeline.LightUtil;
|
||||
import net.minecraftforge.common.model.IModelPart;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.Models;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.state.enums.PylonVariant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ModelPylon implements IPylonModel {
|
||||
|
||||
private static final Function<ResourceLocation, TextureAtlasSprite> TEXTUREGETTER = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
|
||||
private IBakedModel manaCrystal;
|
||||
private IBakedModel manaRingsAndPanes;
|
||||
private IBakedModel manaGems;
|
||||
@@ -57,23 +64,23 @@ public class ModelPylon implements IPylonModel {
|
||||
IModel naturaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon1"))).process(ImmutableMap.of("flip-v", "true"));
|
||||
IModel gaiaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon2"))).process(ImmutableMap.of("flip-v", "true"));
|
||||
|
||||
// All groups are off by default
|
||||
// (OBJState constructor is derp, so the boolean condition is inverted - pass false to turn on a group)
|
||||
// Hide necessary groups and bake
|
||||
VertexFormat format = Attributes.DEFAULT_BAKED_FORMAT;
|
||||
IModelState hideGroups = hideGroups(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04",
|
||||
"Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"));
|
||||
manaCrystal = manaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
|
||||
naturaCrystal = naturaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
|
||||
gaiaCrystal = gaiaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
|
||||
|
||||
// Turn on "Crystal"
|
||||
manaCrystal = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
|
||||
naturaCrystal = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
|
||||
gaiaCrystal = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
|
||||
hideGroups = hideGroups(ImmutableList.of("Crystal", "Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"));
|
||||
manaRingsAndPanes = manaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
|
||||
naturaRingsAndPanes = naturaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
|
||||
gaiaRingsAndPanes = gaiaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
|
||||
|
||||
// Turn on "Crystal_Ring", and "Ring_Panel0x"
|
||||
manaRingsAndPanes = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
|
||||
naturaRingsAndPanes = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
|
||||
gaiaRingsAndPanes = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
|
||||
|
||||
// Turn on "Ring_Gem0x"
|
||||
manaGems = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
|
||||
naturaGems = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
|
||||
gaiaGems = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
|
||||
hideGroups = hideGroups(ImmutableList.of("Crystal", "Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"));
|
||||
manaGems = manaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
|
||||
naturaGems = naturaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
|
||||
gaiaGems = gaiaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
|
||||
} catch(Exception e) {
|
||||
throw new ReportedException(new CrashReport("Error making pylon submodels for TESR!", e));
|
||||
}
|
||||
@@ -129,21 +136,30 @@ public class ModelPylon implements IPylonModel {
|
||||
}
|
||||
|
||||
private void renderModel(IBakedModel model) {
|
||||
renderModel(model, -1);
|
||||
}
|
||||
|
||||
private void renderModel(IBakedModel model, int color) {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer worldrenderer = tessellator.getBuffer();
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
|
||||
|
||||
this.renderQuads(worldrenderer, model.getQuads(null, null, 0), color);
|
||||
for(BakedQuad bakedquad : model.getQuads(null, null, 0))
|
||||
LightUtil.renderQuadColor(worldrenderer, bakedquad, -1);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
private void renderQuads(VertexBuffer renderer, List<BakedQuad> quads, int color) {
|
||||
for(BakedQuad bakedquad : quads)
|
||||
LightUtil.renderQuadColor(renderer, bakedquad, color);
|
||||
private IModelState hideGroups(List<String> groups) {
|
||||
return part -> {
|
||||
if (part.isPresent()) {
|
||||
List<String> parts = new ArrayList<>();
|
||||
Models.getParts(part.get()).forEachRemaining(parts::add);
|
||||
for (String s : parts) {
|
||||
if (groups.contains(s)) {
|
||||
// Hide it
|
||||
return Optional.of(TRSRTransformation.identity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.absent();
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Kihira>. It's 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
|
||||
*
|
||||
* File Created @ [? (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelSkullOverride extends ModelBase {
|
||||
|
||||
private final ModelRenderer bipedHead;
|
||||
private final ModelRenderer bipedHeadwear;
|
||||
|
||||
public ModelSkullOverride() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
bipedHead = new ModelRenderer(this, 0, 0);
|
||||
bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0F);
|
||||
bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
bipedHeadwear = new ModelRenderer(this, 32, 0);
|
||||
bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.5F);
|
||||
bipedHeadwear.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
public void renderWithoutRotation(float par1) {
|
||||
bipedHead.render(par1);
|
||||
bipedHeadwear.render(par1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {
|
||||
setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
|
||||
bipedHead.render(par7);
|
||||
bipedHeadwear.render(par7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) {
|
||||
bipedHead.rotateAngleY = bipedHeadwear.rotateAngleY = par4 / (180F / (float)Math.PI);
|
||||
bipedHead.rotateAngleX = bipedHeadwear.rotateAngleX = par5 / (180F / (float)Math.PI);
|
||||
}
|
||||
}
|
||||
@@ -146,13 +146,8 @@ public class PlatformModel implements IBakedModel {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Biome getBiomeGenForCoords(@Nonnull BlockPos pos) {
|
||||
return compose.getBiomeGenForCoords(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean extendedLevelsInChunkCache() {
|
||||
return compose.extendedLevelsInChunkCache();
|
||||
public Biome getBiome(@Nonnull BlockPos pos) {
|
||||
return compose.getBiome(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -192,15 +192,16 @@ public class SpecialFlowerModel implements IModelCustomData {
|
||||
|
||||
@Override
|
||||
public Optional<IBakedModel> load(@Nonnull String key) {
|
||||
if (key == null) Botania.LOGGER.error("Null passed to special model cacheloader?!");
|
||||
Map<Optional<String>, ModelResourceLocation> loadFrom = loadBlocks ? blockModels : itemModels;
|
||||
|
||||
ModelResourceLocation loc = loadFrom.get(Optional.of(key));
|
||||
if(loc == null)
|
||||
return Optional.empty();
|
||||
|
||||
IModel model = ModelLoaderRegistry.getModelOrMissing(loc);
|
||||
if(model == ModelLoaderRegistry.getMissingModel())
|
||||
return Optional.empty();
|
||||
|
||||
return Optional.of(model.bake(new SimpleModelState(transforms), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter()));
|
||||
}
|
||||
}
|
||||
@@ -208,18 +209,18 @@ public class SpecialFlowerModel implements IModelCustomData {
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) {
|
||||
if(state.getBlock() != ModBlocks.specialFlower)
|
||||
if(state.getBlock() != ModBlocks.specialFlower) {
|
||||
Botania.LOGGER.fatal("FOREIGN BLOCK: " + state);
|
||||
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel().getQuads(state, face, rand);
|
||||
}
|
||||
|
||||
IExtendedBlockState extendedState = ((IExtendedBlockState) state);
|
||||
String subtileId = extendedState.getValue(BotaniaStateProps.SUBTILE_ID);
|
||||
|
||||
IBakedModel ret = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
|
||||
if(subtileId != null) { // Todo remove - workaround for subtile ID being null?
|
||||
Optional<IBakedModel> specialModel = bakedBlockModels.getUnchecked(extendedState.getValue(BotaniaStateProps.SUBTILE_ID));
|
||||
if(specialModel.isPresent())
|
||||
ret = specialModel.get();
|
||||
}
|
||||
Optional<IBakedModel> specialModel = bakedBlockModels.getUnchecked(subtileId == null ? "" : subtileId);
|
||||
if(specialModel.isPresent())
|
||||
ret = specialModel.get();
|
||||
|
||||
return ret.getQuads(state, face, rand);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package vazkii.botania.client.render;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IModelRegister {
|
||||
/**
|
||||
* Do whatever needs to be done to register models
|
||||
* For Blocks, statemapper registration needs to be done BEFORE itemblock registration
|
||||
* Exceptions to that rule are noted
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels();
|
||||
}
|
||||
@@ -10,11 +10,18 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.entity;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.entity.EntityCorporeaSpark;
|
||||
|
||||
public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
|
||||
@@ -48,13 +55,16 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
|
||||
|
||||
@Override
|
||||
public void renderCallback(EntityCorporeaSpark entity, float pticks) {
|
||||
/*
|
||||
int time = entity.getItemDisplayTicks();
|
||||
if(time == 0)
|
||||
return;
|
||||
|
||||
float absTime = Math.abs(time) - pticks;
|
||||
|
||||
ItemStack stack = entity.getDisplayedItem().orNull();
|
||||
if(stack == null)
|
||||
return;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
||||
float scalef = 1F / 6F;
|
||||
@@ -64,14 +74,8 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
|
||||
GlStateManager.color(1F, 1F, 1F, absTime / 10);
|
||||
GlStateManager.translate(0F, 0F, -2F + (time < 0 ? -absTime : absTime) / 6);
|
||||
|
||||
ItemStack stack = entity.getDisplayedItem();
|
||||
if(stack == null)
|
||||
return;
|
||||
|
||||
Item item = stack.getItem();
|
||||
boolean block = item instanceof ItemBlock;
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(block ? TextureMap.LOCATION_BLOCKS_TEXTURE : TextureMap.locationItemsTexture);
|
||||
IIcon icon = block ? Block.getBlockFromItem(item).getBlockTextureFromSide(ForgeDirection.UP.ordinal()) : item.getIcon(stack, 0);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
TextureAtlasSprite icon = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, entity.worldObj, null).getParticleTexture();
|
||||
|
||||
if(icon != null) {
|
||||
float minU = icon.getMinU();
|
||||
@@ -91,7 +95,7 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
|
||||
GlStateManager.translate(gap * i, 0F, 0F);
|
||||
for(int j = -shift; j < shift; j++) {
|
||||
GlStateManager.translate(0F, gap * j, 0F);
|
||||
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), minU + stepU * (i + shift), minV + stepV * (j + shift + 1), minU + stepU * (i + shift + 1), minV + stepV * (j + shift), icon.getIconWidth() / pieces, icon.getIconHeight() / pieces, 1F / 8F);
|
||||
IconHelper.renderIconIn3D(Tessellator.getInstance(), minU + stepU * (i + shift), minV + stepV * (j + shift + 1), minU + stepU * (i + shift + 1), minV + stepV * (j + shift), icon.getIconWidth() / pieces, icon.getIconHeight() / pieces, 1F / 8F);
|
||||
GlStateManager.translate(0F, -gap * j, 0F);
|
||||
}
|
||||
GlStateManager.translate(-gap * i, 0F, 0F);
|
||||
@@ -100,7 +104,6 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popMatrix();
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Random;
|
||||
@@ -28,6 +29,9 @@ public class RenderTileFloatingFlower extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(@Nonnull TileEntity tile, double d0, double d1, double d2, float t, int digProgress) {
|
||||
if(ConfigHandler.staticFloaters)
|
||||
return;
|
||||
|
||||
if (tile != null)
|
||||
if (!tile.getWorld().isBlockLoaded(tile.getPos(), false))
|
||||
return;
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.entity.boss.EntityWither;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.monster.SkeletonType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntitySkull;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -62,7 +63,7 @@ public class RenderTileGaiaHead extends TileEntitySkullRenderer {
|
||||
profile = ((EntityPlayer) mc.getRenderViewEntity()).getGameProfile();
|
||||
} else if (view instanceof EntitySkeleton) {
|
||||
skullType = 0;
|
||||
if(Botania.crossVersionProxy.getSkeletonTypeInt((EntitySkeleton) view) == 1)
|
||||
if (((EntitySkeleton) view).getSkeletonType() == SkeletonType.WITHER)
|
||||
skullType = 1;
|
||||
} else if(view instanceof EntityWither)
|
||||
skullType = 1;
|
||||
|
||||
@@ -36,13 +36,8 @@ import java.util.Random;
|
||||
public class RenderTilePylon extends TileEntitySpecialRenderer<TilePylon> {
|
||||
|
||||
private static final ResourceLocation textureOld = new ResourceLocation(LibResources.MODEL_PYLON_OLD);
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_PYLON);
|
||||
|
||||
private static final ResourceLocation textureGreenOld = new ResourceLocation(LibResources.MODEL_PYLON_GREEN_OLD);
|
||||
private static final ResourceLocation textureGreen = new ResourceLocation(LibResources.MODEL_PYLON_GREEN);
|
||||
|
||||
private static final ResourceLocation texturePinkOld = new ResourceLocation(LibResources.MODEL_PYLON_PINK_OLD);
|
||||
private static final ResourceLocation texturePink = new ResourceLocation(LibResources.MODEL_PYLON_PINK);
|
||||
|
||||
IPylonModel model;
|
||||
public static boolean green = false;
|
||||
|
||||
@@ -39,15 +39,27 @@ import vazkii.botania.client.model.ModelTinyPotato;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileTinyPotato;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemBaubleCosmetic;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPotato> {
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_TINY_POTATO);
|
||||
private static final ResourceLocation textureGrayscale = new ResourceLocation(LibResources.MODEL_TINY_POTATO_GS);
|
||||
private static final ResourceLocation textureHalloween = new ResourceLocation(LibResources.MODEL_TINY_POTATO_HALLOWEEN);
|
||||
private static final ModelTinyPotato model = new ModelTinyPotato();
|
||||
private final ItemStack[] cosmetics = Arrays.stream(ItemBaubleCosmetic.Variants.values()).map(v -> new ItemStack(ModItems.cosmetic, 1, v.ordinal())).toArray(ItemStack[]::new);
|
||||
|
||||
|
||||
private static boolean matches(String name, String match) {
|
||||
return name.equals(match) || name.startsWith(match + " ");
|
||||
}
|
||||
|
||||
private static String removeFromFront(String name, String match) {
|
||||
return name.substring(match.length()).trim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(@Nonnull TileTinyPotato potato, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
@@ -62,28 +74,28 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
mc.renderEngine.bindTexture(ClientProxy.dootDoot ? textureHalloween : texture);
|
||||
String name = potato.name.toLowerCase();
|
||||
String name = potato.name.toLowerCase().trim();
|
||||
|
||||
boolean usedShader = false;
|
||||
if (name.startsWith("gaia ")) {
|
||||
if (matches(name, "gaia")) {
|
||||
ShaderHelper.useShader(ShaderHelper.doppleganger);
|
||||
name = name.substring(5);
|
||||
name = removeFromFront(name, "gaia");
|
||||
usedShader = true;
|
||||
} else if (name.startsWith("hot ")) {
|
||||
} else if (matches(name, "hot")) {
|
||||
ShaderHelper.useShader(ShaderHelper.halo);
|
||||
name = name.substring(4);
|
||||
name = removeFromFront(name, "hot");
|
||||
usedShader = true;
|
||||
} else if (name.startsWith("magic ")) {
|
||||
} else if (matches(name, "magic")) {
|
||||
ShaderHelper.useShader(ShaderHelper.enchanterRune);
|
||||
name = name.substring(6);
|
||||
name = removeFromFront(name, "magic");
|
||||
usedShader = true;
|
||||
} else if (name.startsWith("gold ")) {
|
||||
} else if (matches(name, "gold")) {
|
||||
ShaderHelper.useShader(ShaderHelper.gold);
|
||||
name = name.substring(5);
|
||||
name = removeFromFront(name, "gold");
|
||||
usedShader = true;
|
||||
} else if (name.startsWith("snoop ")) {
|
||||
} else if (matches(name, "snoop")) {
|
||||
ShaderHelper.useShader(ShaderHelper.terraPlateRune);
|
||||
name = name.substring(6);
|
||||
name = removeFromFront(name, "snoop");
|
||||
usedShader = true;
|
||||
}
|
||||
|
||||
@@ -104,16 +116,23 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
|
||||
GlStateManager.rotate(rotZ, 0F, 0F, 1F);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
if (name.equals("pahimar")) {
|
||||
GlStateManager.scale(1F, 0.3F, 1F);
|
||||
GlStateManager.translate(0F, 3.5F, 0F);
|
||||
} else if (name.equals("kyle hyde"))
|
||||
mc.renderEngine.bindTexture(textureGrayscale);
|
||||
else if (name.equals("dinnerbone") || name.equals("grumm")) {
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.translate(0F, -2.625F, 0F);
|
||||
} else if (name.equals("aureylian"))
|
||||
GlStateManager.color(1F, 0.5F, 1F);
|
||||
switch (name) {
|
||||
case "pahimar":
|
||||
GlStateManager.scale(1F, 0.3F, 1F);
|
||||
GlStateManager.translate(0F, 3.5F, 0F);
|
||||
break;
|
||||
case "kyle hyde":
|
||||
mc.renderEngine.bindTexture(textureGrayscale);
|
||||
break;
|
||||
case "dinnerbone":
|
||||
case "grumm":
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.translate(0F, -2.625F, 0F);
|
||||
break;
|
||||
case "aureylian":
|
||||
GlStateManager.color(1F, 0.5F, 1F);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
boolean render = !(name.equals("mami") || name.equals("soaryn") || name.equals("eloraam") && jump != 0);
|
||||
@@ -154,14 +173,15 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
|
||||
} else if (name.equals("skull kid")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.translate(0F, -0.7F, -0.4F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 23));
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -1.6F, 0F);
|
||||
renderItem(cosmetics[23]);
|
||||
} else if (name.equals("kamina")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -0.6F, 0.4F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 26));
|
||||
GlStateManager.translate(0F, -1.4F, 0F);
|
||||
renderItem(cosmetics[26]);
|
||||
} else if (name.equals("haighyorkie")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
@@ -171,103 +191,98 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
|
||||
} else if (name.equals("chitoge")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -0.2F, 0.1F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 7));
|
||||
GlStateManager.translate(0F, -1F, -0.4F);
|
||||
renderItem(cosmetics[7]);
|
||||
} else if (name.equals("direwolf20")) {
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -1.7F, 0.5F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic));
|
||||
GlStateManager.translate(0F, -2.5F, 0.125F);
|
||||
renderItem(cosmetics[0]);
|
||||
} else if (name.equals("doctor")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -0.65F, 0.4F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 25));
|
||||
GlStateManager.translate(0F, -1.45F, 0F);
|
||||
renderItem(cosmetics[25]);
|
||||
} else if (name.equals("snoo")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0.2F, 0F, -0.05F);
|
||||
GlStateManager.rotate(-20F, 0F, 0F, 1F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 24));
|
||||
GlStateManager.translate(0F, -0.75F, -0.5F);
|
||||
renderItem(cosmetics[24]);
|
||||
} else if (name.equals("charlotte")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -0.7F, 0.4F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 12));
|
||||
GlStateManager.translate(0F, -1.6F, 0F);
|
||||
renderItem(cosmetics[12]);
|
||||
} else if (name.equals("greg") || name.equals("gregorioust")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -1F, 0.4F);
|
||||
GlStateManager.translate(0F, -1.5F, -0.9F);
|
||||
renderItem(new ItemStack(Items.BOOK));
|
||||
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.scale(0.3F, 0.3F, 0.3F);
|
||||
GlStateManager.translate(0F, 2.5F, 1.5F);
|
||||
renderItem(new ItemStack(Blocks.IRON_ORE));
|
||||
} else if (name.equals("profmobius")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -0.7F, 0.4F);
|
||||
GlStateManager.translate(0F, -1.5F, -0.9F);
|
||||
renderItem(new ItemStack(Items.BREAD));
|
||||
} else if (name.equals("martysgames") || name.equals("marty")) {
|
||||
GlStateManager.scale(0.7F, 0.7F, 0.7F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0.3F, -1.8F, 0.7F);
|
||||
GlStateManager.rotate(-15F, 0F, 0F, 1F);
|
||||
GlStateManager.translate(-0.3F, -2.7F, -1.2F);
|
||||
GlStateManager.rotate(15F, 0F, 0F, 1F);
|
||||
renderItem(new ItemStack(ModItems.infiniteFruit, 1).setStackDisplayName("das boot"));
|
||||
} else if (name.equals("tromped")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -0.7F, 0.4F);
|
||||
GlStateManager.translate(0F, -1.5F, -0.9F);
|
||||
renderItem(new ItemStack(ModItems.cacophonium));
|
||||
} else if (name.equals("kain vinosec")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(-0.3F, -1F, 0.4F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0.25F, -1.8F, -0.9F);
|
||||
renderItem(new ItemStack(ModItems.recordGaia1));
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
GlStateManager.translate(0F, 0F, -0.85F);
|
||||
GlStateManager.translate(0F, 0F, 0.85F);
|
||||
renderItem(new ItemStack(ModItems.recordGaia2));
|
||||
} else if (name.equals("mankrik")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, 0.3F, 0.1F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 31));
|
||||
GlStateManager.translate(0F, -0.5F, -0.5F);
|
||||
renderItem(cosmetics[31]);
|
||||
} else if (name.equals("kurumi")) {
|
||||
GlStateManager.scale(0.4F, 0.4F, 0.4F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0.4F, -2F, 1.3F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 17));
|
||||
GlStateManager.translate(-0.45F, -2.85F, -1.75F);
|
||||
renderItem(cosmetics[17]);
|
||||
} else if (name.equals("ichun")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -0.7F, 0.4F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 15));
|
||||
GlStateManager.translate(0F, -1.45F, 0F);
|
||||
renderItem(cosmetics[15]);
|
||||
} else if (name.equals("wiiv") || name.equals("dylan4ever") || name.equals("dylankaiser")) {
|
||||
GlStateManager.scale(1.5F, 1.5F, 1.5F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(-0.1F, -0.6F, -0.325F);
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -1.5F, -0.9F);
|
||||
renderItem(new ItemStack(Items.PAINTING));
|
||||
} else if (name.equals("jibril")) {
|
||||
GlStateManager.scale(1.5F, 1.5F, 1.5F);
|
||||
GlStateManager.translate(0F, 0.7F, 0F);
|
||||
GlStateManager.translate(0F, -0.8F, 0F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
ItemFlightTiara.renderHalo(null, partialTicks);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
} else if (name.equals("nebris")) {
|
||||
GlStateManager.scale(2F, 2F, 2F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
renderItem(new ItemStack(Blocks.GLOWSTONE));
|
||||
@@ -281,56 +296,64 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
|
||||
renderBlock(Blocks.PORTAL);
|
||||
} else if (name.equals("razz") || name.equals("razzleberryfox")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0, -0.5F, 0.45F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 8));
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -1.5F, 0F);
|
||||
renderItem(cosmetics[8]);
|
||||
} else if (name.equals("etho") || name.equals("ethoslab")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -0.7F, 0.4F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -1.5F, -0.9F);
|
||||
renderItem(new ItemStack(Items.COOKIE));
|
||||
} else if (name.equals("sethbling")) {
|
||||
GlStateManager.scale(1.2F, 1.2F, 1.2F);
|
||||
GlStateManager.rotate(-90F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(-0.5F, 1.4F, -0.5F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
renderBlock(Blocks.COMMAND_BLOCK);
|
||||
} else if (name.equals("bdoubleo100") || name.equals("bdoubleo")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0.5F, -0.6F, 0.1F);
|
||||
GlStateManager.translate(-0.65F, -1.5F, -0.45F);
|
||||
renderItem(new ItemStack(Items.STICK));
|
||||
} else if (name.equals("kingdaddydmac")) {
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(270F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(-0.3F, -2F, -1.075F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -3F, 0.65F);
|
||||
renderItem(new ItemStack(ModItems.manaRing, 1, 0));
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
GlStateManager.translate(0F, 0F, 4F);
|
||||
GlStateManager.translate(0F, 0F, -4F);
|
||||
renderItem(new ItemStack(ModItems.manaRing, 1, 0));
|
||||
|
||||
GlStateManager.scale(0.8F, 0.8F, 0.8F);
|
||||
GlStateManager.translate(-1.7F, -1.2F, -0.1F);
|
||||
GlStateManager.translate(1.25F, -1.25F, 2.25F);
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
renderBlock(Blocks.CAKE);
|
||||
} else if (name.equals("sjin")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, -0.77F, 0.4F);
|
||||
renderItem(new ItemStack(ModItems.cosmetic, 1, 27));
|
||||
GlStateManager.translate(0F, -1.6F, 0F);
|
||||
renderItem(cosmetics[27]);
|
||||
} else if (name.equals("martyn") || name.equals("inthelittlewood")) {
|
||||
GlStateManager.scale(1.25F, 1.25F, 1.25F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(180F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0F, 0.05F, 0.1F);
|
||||
GlStateManager.translate(0F, -0.8F, -0.2F);
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
renderItem(new ItemStack(Blocks.SAPLING, 0, 0));
|
||||
} else if (name.equals("williewillus")) {
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
renderItem(new ItemStack(Blocks.RED_NETHER_BRICK));
|
||||
GlStateManager.scale(0.75F, 0.75F, 0.75F);
|
||||
GlStateManager.translate(-1.1F, -1.25F, 0F);
|
||||
renderItem(new ItemStack(Blocks.CHORUS_FLOWER));
|
||||
GlStateManager.translate(2.2F, 0F, 0F);
|
||||
renderItem(new ItemStack(Blocks.PRISMARINE));
|
||||
} else if (ContributorFancinessHandler.flowerMap != null && ContributorFancinessHandler.flowerMap.containsKey(name)) {
|
||||
ItemStack icon = ContributorFancinessHandler.flowerMap.get(name);
|
||||
if (icon != null) {
|
||||
@@ -410,7 +433,7 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public void renderIcon(TextureAtlasSprite icon) {
|
||||
private void renderIcon(TextureAtlasSprite icon) {
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
@@ -418,11 +441,12 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
|
||||
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
}
|
||||
|
||||
public void renderItem(ItemStack stack) {
|
||||
private void renderItem(ItemStack stack) {
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.HEAD);
|
||||
}
|
||||
|
||||
public void renderBlock(Block block) {
|
||||
private void renderBlock(Block block) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(block.getDefaultState(), 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import vazkii.botania.common.world.WorldTypeSkyblock;
|
||||
public final class SkyblockRenderEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRender(RenderWorldLastEvent event) {
|
||||
public static void onRender(RenderWorldLastEvent event) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if(ConfigHandler.enableFancySkybox && world.provider.getDimension() == 0 && (ConfigHandler.enableFancySkyboxInNormalWorlds || WorldTypeSkyblock.isWorldSkyblock(Minecraft.getMinecraft().theWorld))) {
|
||||
if(!(world.provider.getSkyRenderer() instanceof SkyblockSkyRenderer))
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
*/
|
||||
package vazkii.botania.common;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.event.ClickEvent;
|
||||
import net.minecraft.util.text.event.HoverEvent;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.EntityDragonPart;
|
||||
import net.minecraft.entity.boss.EntityWither;
|
||||
import net.minecraft.entity.item.EntityEnderCrystal;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.entity.item.EntityPainting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
@@ -33,17 +33,64 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.ITwoNamedPage;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
import vazkii.botania.common.block.ModBanners;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.ModMultiblocks;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus;
|
||||
import vazkii.botania.common.block.tile.TileLightRelay;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
import vazkii.botania.common.brew.ModBrews;
|
||||
import vazkii.botania.common.brew.ModPotions;
|
||||
import vazkii.botania.common.core.command.CommandOpen;
|
||||
import vazkii.botania.common.core.command.CommandShare;
|
||||
import vazkii.botania.common.core.command.CommandSkyblockSpread;
|
||||
import vazkii.botania.common.core.handler.BiomeDecorationHandler;
|
||||
import vazkii.botania.common.core.handler.CommonTickHandler;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.handler.IMCHandler;
|
||||
import vazkii.botania.common.core.handler.InternalMethodHandler;
|
||||
import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.core.proxy.CommonProxy;
|
||||
import vazkii.botania.common.core.proxy.ICrossVersionProxy;
|
||||
import vazkii.botania.common.core.handler.ModSounds;
|
||||
import vazkii.botania.common.core.handler.PixieHandler;
|
||||
import vazkii.botania.common.core.handler.SheddingHandler;
|
||||
import vazkii.botania.common.core.loot.LootHandler;
|
||||
import vazkii.botania.common.core.proxy.IProxy;
|
||||
import vazkii.botania.common.crafting.ModBrewRecipes;
|
||||
import vazkii.botania.common.crafting.ModCraftingRecipes;
|
||||
import vazkii.botania.common.crafting.ModElvenTradeRecipes;
|
||||
import vazkii.botania.common.crafting.ModManaAlchemyRecipes;
|
||||
import vazkii.botania.common.crafting.ModManaConjurationRecipes;
|
||||
import vazkii.botania.common.crafting.ModManaInfusionRecipes;
|
||||
import vazkii.botania.common.crafting.ModMigrationRecipes;
|
||||
import vazkii.botania.common.crafting.ModPetalRecipes;
|
||||
import vazkii.botania.common.crafting.ModPureDaisyRecipes;
|
||||
import vazkii.botania.common.crafting.ModRuneRecipes;
|
||||
import vazkii.botania.common.entity.EntityCorporeaSpark;
|
||||
import vazkii.botania.common.entity.EntityDoppleganger;
|
||||
import vazkii.botania.common.entity.EntityFlameRing;
|
||||
import vazkii.botania.common.entity.EntityMagicLandmine;
|
||||
import vazkii.botania.common.entity.EntityMagicMissile;
|
||||
import vazkii.botania.common.entity.EntityManaBurst;
|
||||
import vazkii.botania.common.entity.EntityPinkWither;
|
||||
import vazkii.botania.common.entity.EntitySignalFlare;
|
||||
import vazkii.botania.common.entity.EntitySpark;
|
||||
import vazkii.botania.common.entity.ModEntities;
|
||||
import vazkii.botania.common.integration.buildcraft.StatementAPIPlugin;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.Map;
|
||||
import vazkii.botania.common.network.GuiHandler;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
import vazkii.botania.common.world.SkyblockWorldEvents;
|
||||
import vazkii.botania.common.world.WorldTypeSkyblock;
|
||||
|
||||
@Mod(modid = LibMisc.MOD_ID, name = LibMisc.MOD_NAME, version = LibMisc.VERSION, dependencies = LibMisc.DEPENDENCIES,
|
||||
guiFactory = LibMisc.GUI_FACTORY, acceptedMinecraftVersions = LibMisc.MC_VERSIONS, updateJSON = LibMisc.UPDATE_JSON)
|
||||
@@ -63,36 +110,13 @@ public class Botania {
|
||||
@Instance(LibMisc.MOD_ID)
|
||||
public static Botania instance;
|
||||
|
||||
@SidedProxy(serverSide = LibMisc.PROXY_COMMON, clientSide = LibMisc.PROXY_CLIENT)
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static ICrossVersionProxy crossVersionProxy;
|
||||
@SidedProxy(serverSide = LibMisc.PROXY_SERVER, clientSide = LibMisc.PROXY_CLIENT)
|
||||
public static IProxy proxy;
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger(LibMisc.MOD_ID);
|
||||
|
||||
private static final Map<String, String> PROXY_MAP = ImmutableMap.of(
|
||||
"1.9.4", "vazkii.botania.common.core.proxy.CrossVersionProxy_19",
|
||||
"1.10", "vazkii.botania.common.core.proxy.CrossVersionProxy_110",
|
||||
"1.10.2", "vazkii.botania.common.core.proxy.CrossVersionProxy_110"
|
||||
);
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
try {
|
||||
// The constant is inlined at compile time, we want the real value.
|
||||
String mcVersion = (String) Loader.class.getDeclaredField("MC_VERSION").get(null);
|
||||
|
||||
if(!PROXY_MAP.containsKey(mcVersion))
|
||||
throw new IllegalStateException("Botania couldn't find a cross version proxy!");
|
||||
|
||||
Class clazz = Class.forName(PROXY_MAP.get(mcVersion));
|
||||
crossVersionProxy = (ICrossVersionProxy) clazz.newInstance();
|
||||
|
||||
Botania.LOGGER.info("Enabling proxy for Minecraft {}", mcVersion);
|
||||
} catch (NoSuchFieldException | ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
|
||||
throw new IllegalStateException("Botania couldn't find a cross version proxy!", ex);
|
||||
}
|
||||
|
||||
gardenOfGlassLoaded = Loader.isModLoaded("GardenOfGlass");
|
||||
|
||||
thaumcraftLoaded = Loader.isModLoaded("Thaumcraft");
|
||||
@@ -105,36 +129,116 @@ public class Botania {
|
||||
|
||||
storageDrawersLoaded = Loader.isModLoaded("StorageDrawers");
|
||||
|
||||
proxy.preInit(event);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
BotaniaAPI.internalHandler = new InternalMethodHandler();
|
||||
|
||||
@SubscribeEvent
|
||||
public void nagRemoval(PlayerEvent.PlayerLoggedInEvent evt) {
|
||||
EntityPlayer player = evt.player;
|
||||
ITextComponent message = new TextComponentTranslation("botaniamisc.unofficial.warnRemove");
|
||||
message.setStyle(new Style().setColor(TextFormatting.RED));
|
||||
player.addChatComponentMessage(message);
|
||||
ConfigHandler.loadConfig(event.getSuggestedConfigurationFile());
|
||||
|
||||
PacketHandler.init();
|
||||
ModSounds.init();
|
||||
ModBlocks.init();
|
||||
ModItems.init();
|
||||
ModEntities.init();
|
||||
ModPotions.init();
|
||||
ModBrews.init();
|
||||
|
||||
ModAchievements.init();
|
||||
ModMultiblocks.init();
|
||||
ModBanners.init();
|
||||
|
||||
if(Botania.gardenOfGlassLoaded)
|
||||
new WorldTypeSkyblock();
|
||||
|
||||
proxy.preInit(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
ModCraftingRecipes.init();
|
||||
ModMigrationRecipes.init();
|
||||
ModPetalRecipes.init();
|
||||
ModPureDaisyRecipes.init();
|
||||
ModRuneRecipes.init();
|
||||
ModManaAlchemyRecipes.init();
|
||||
ModManaConjurationRecipes.init();
|
||||
ModManaInfusionRecipes.init();
|
||||
ModElvenTradeRecipes.init();
|
||||
ModBrewRecipes.init();
|
||||
LexiconData.init();
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(Botania.instance, new GuiHandler());
|
||||
|
||||
MinecraftForge.TERRAIN_GEN_BUS.register(BiomeDecorationHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(ManaNetworkHandler.instance);
|
||||
MinecraftForge.EVENT_BUS.register(PixieHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(SheddingHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(SubTileNarslimmus.SpawnIntercepter.class);
|
||||
MinecraftForge.EVENT_BUS.register(TileCorporeaIndex.getInputHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new LootHandler());
|
||||
|
||||
if(Botania.gardenOfGlassLoaded)
|
||||
MinecraftForge.EVENT_BUS.register(SkyblockWorldEvents.class);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(CommonTickHandler.class);
|
||||
|
||||
FMLInterModComms.sendMessage("ProjectE", "interdictionblacklist", EntityManaBurst.class.getCanonicalName());
|
||||
|
||||
if(Botania.bcTriggersLoaded)
|
||||
new StatementAPIPlugin();
|
||||
proxy.init(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if(Botania.thaumcraftLoaded) {
|
||||
ModBrews.initTC();
|
||||
ModBrewRecipes.initTC();
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends Entity> clazz = (Class<? extends Entity>) Class.forName("thaumcraft.common.lib.aura.EntityAuraNode");
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(clazz);
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
}
|
||||
|
||||
ModBlocks.addDispenserBehaviours();
|
||||
ModBlocks.registerMultiparts();
|
||||
ConfigHandler.loadPostInit();
|
||||
LexiconData.postInit();
|
||||
|
||||
int words = 0;
|
||||
for(LexiconEntry entry : BotaniaAPI.getAllEntries())
|
||||
for(LexiconPage page : entry.pages) {
|
||||
words += countWords(page.getUnlocalizedName());
|
||||
if(page instanceof ITwoNamedPage)
|
||||
words += countWords(((ITwoNamedPage) page).getSecondUnlocalizedName());
|
||||
}
|
||||
Botania.LOGGER.info("The Lexica Botania has {} words.", words);
|
||||
|
||||
registerDefaultEntityBlacklist();
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
// Overriding the internal method handler will break everything as it changes regularly.
|
||||
// So just don't be a moron and don't override it. Thanks.
|
||||
@EventHandler
|
||||
public void serverStarting(FMLServerAboutToStartEvent event) {
|
||||
proxy.serverAboutToStart(event);
|
||||
String clname = BotaniaAPI.internalHandler.getClass().getName();
|
||||
String expect = "vazkii.botania.common.core.handler.InternalMethodHandler";
|
||||
if(!clname.equals(expect)) {
|
||||
new IllegalAccessError("The Botania API internal method handler has been overriden. "
|
||||
+ "This will cause crashes and compatibility issues, and that's why it's marked as"
|
||||
+ " \"Do not Override\". Whoever had the brilliant idea of overriding it needs to go"
|
||||
+ " back to elementary school and learn to read. (Expected classname: " + expect + ", Actual classname: " + clname + ")").printStackTrace();
|
||||
FMLCommonHandler.instance().exitJava(1, true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
proxy.serverStarting(event);
|
||||
// todo 1.8 - we don't have a file server yet. event.registerServerCommand(new CommandDownloadLatest());
|
||||
event.registerServerCommand(new CommandShare());
|
||||
event.registerServerCommand(new CommandOpen());
|
||||
if(Botania.gardenOfGlassLoaded)
|
||||
event.registerServerCommand(new CommandSkyblockSpread());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -147,4 +251,31 @@ public class Botania {
|
||||
IMCHandler.processMessages(event.getMessages());
|
||||
}
|
||||
|
||||
private int countWords(String s) {
|
||||
String s1 = I18n.translateToLocal(s);
|
||||
return s1.split("\\s+").length;
|
||||
}
|
||||
|
||||
private void registerDefaultEntityBlacklist() {
|
||||
// Vanilla
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityDragon.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityDragonPart.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityWither.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityItemFrame.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityEnderCrystal.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityPainting.class);
|
||||
|
||||
// Botania
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityCorporeaSpark.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityDoppleganger.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityFlameRing.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityMagicLandmine.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityMagicMissile.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityManaBurst.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntityPinkWither.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntitySignalFlare.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(EntitySpark.class);
|
||||
BotaniaAPI.blacklistEntityFromGravityRod(TileLightRelay.EntityPlayerMover.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,8 +18,10 @@ import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemPickupEvent;
|
||||
|
||||
public final class AchievementTriggerer {
|
||||
|
||||
private AchievementTriggerer() {}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onItemPickedUp(ItemPickupEvent event) {
|
||||
public static void onItemPickedUp(ItemPickupEvent event) {
|
||||
ItemStack stack = event.pickedUp.getEntityItem();
|
||||
if(stack != null && stack.getItem() instanceof IPickupAchievement) {
|
||||
Achievement achievement = ((IPickupAchievement) stack.getItem()).getAchievementOnPickup(stack, event.player, event.pickedUp);
|
||||
@@ -29,7 +31,7 @@ public final class AchievementTriggerer {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onItemCrafted(ItemCraftedEvent event) {
|
||||
public static void onItemCrafted(ItemCraftedEvent event) {
|
||||
if(event.crafting != null && event.crafting.getItem() instanceof ICraftAchievement) {
|
||||
Achievement achievement = ((ICraftAchievement) event.crafting.getItem()).getAchievementOnCraft(event.crafting, event.player, event.craftMatrix);
|
||||
if(achievement != null)
|
||||
|
||||
@@ -157,7 +157,7 @@ public final class ModAchievements {
|
||||
botaniaPage = new AchievementPage(LibMisc.MOD_NAME, AchievementMod.achievements.toArray(new Achievement[AchievementMod.achievements.size()]));
|
||||
AchievementPage.registerAchievementPage(botaniaPage);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new AchievementTriggerer());
|
||||
MinecraftForge.EVENT_BUS.register(AchievementTriggerer.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,10 +29,13 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.AltGrassVariant;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
@@ -79,6 +82,7 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for(int i = 0; i < 6; i++)
|
||||
@@ -117,6 +121,7 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
|
||||
return type == EnumPlantType.Plains || type == EnumPlantType.Beach;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random r) {
|
||||
if (state.getBlock() != this)
|
||||
@@ -135,13 +140,13 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
|
||||
break;
|
||||
case INFUSED:
|
||||
if(r.nextInt(100) == 0)
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0F, 1F, 1F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0F, 1F, 1F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
break;
|
||||
case MUTATED:
|
||||
if(r.nextInt(100) == 0) {
|
||||
if(r.nextInt(100) > 25)
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 0F, 1F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
else Botania.proxy.sparkleFX(world, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 1F, 0F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 0F, 1F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
else Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 1F, 0F, r.nextFloat() * 0.2F + 1F, 5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -151,4 +156,10 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
|
||||
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
|
||||
return LexiconData.grassSeeds;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, AltGrassVariant.values().length);
|
||||
}
|
||||
}
|
||||
@@ -30,19 +30,20 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.AltarVariant;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.TileAltar;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
@@ -109,6 +110,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
|
||||
return state;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
@@ -120,6 +122,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for(int i = 0; i < 9; i++)
|
||||
@@ -178,7 +181,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
|
||||
} else if(stack != null && stack.getItem() == Items.BUCKET && (tile.hasWater || tile.hasLava) && !Botania.gardenOfGlassLoaded) {
|
||||
ItemStack bucket = tile.hasLava ? new ItemStack(Items.LAVA_BUCKET) : new ItemStack(Items.WATER_BUCKET);
|
||||
if(stack.stackSize == 1)
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, bucket);
|
||||
player.setHeldItem(hand, bucket);
|
||||
else {
|
||||
if(!player.inventory.addItemStackToInventory(bucket))
|
||||
player.dropItem(bucket, false);
|
||||
@@ -281,4 +284,10 @@ public class BlockAltar extends BlockMod implements ILexiconable {
|
||||
return LexiconData.apothecary;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, AltarVariant.values().length - 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,9 +14,11 @@ import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -27,10 +29,15 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.item.IAvatarWieldable;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.tile.TileAvatar;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
@@ -146,4 +153,13 @@ public class BlockAvatar extends BlockMod implements ILexiconable {
|
||||
return LexiconData.avatar;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileAvatar.class);
|
||||
ModelHandler.registerCustomItemblock(this, "avatar");
|
||||
super.registerModels();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,8 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.common.block.tile.TileBifrost;
|
||||
@@ -42,7 +44,6 @@ public class BlockBifrost extends BlockMod implements ILexiconable {
|
||||
setLightLevel(1F);
|
||||
setBlockUnbreakable();
|
||||
setSoundType(SoundType.GLASS);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,6 +68,7 @@ public class BlockBifrost extends BlockMod implements ILexiconable {
|
||||
return block != this && super.shouldSideBeRendered(state, world, pos, side);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
|
||||
@@ -20,6 +20,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.common.Botania;
|
||||
@@ -56,9 +58,10 @@ public class BlockBifrostPerm extends BlockMod implements ILexiconable {
|
||||
@Override
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
if(rand.nextBoolean())
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
|
||||
Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
|
||||
@@ -34,7 +34,6 @@ public abstract class BlockCamo extends BlockMod {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack currentStack, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class BlockFakeAir extends BlockMod {
|
||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||
|
||||
public BlockFakeAir() {
|
||||
super(Material.AIR, LibBlockNames.FAKE_AIR);
|
||||
super(Material.STRUCTURE_VOID, LibBlockNames.FAKE_AIR);
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class BlockFakeAir extends BlockMod {
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
if(shouldRemove(world, pos))
|
||||
world.setBlockState(pos, Blocks.WATER.getDefaultState());
|
||||
world.setBlockState(pos, rand.nextInt(10) == 0 ? Blocks.WATER.getDefaultState() : Blocks.AIR.getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,9 +27,12 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
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;
|
||||
|
||||
@@ -43,7 +46,7 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
|
||||
super(Material.GOURD, LibBlockNames.FEL_PUMPKIN);
|
||||
setHardness(1F);
|
||||
setSoundType(SoundType.WOOD);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(BlockFelPumpkin.class);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
|
||||
}
|
||||
|
||||
@@ -88,7 +91,7 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrops(LivingDropsEvent event) {
|
||||
public static void onDrops(LivingDropsEvent event) {
|
||||
if(event.getEntityLiving() instanceof EntityBlaze && event.getEntityLiving().getEntityData().getBoolean(TAG_FEL_SPAWNED))
|
||||
if(event.getDrops().isEmpty())
|
||||
event.getDrops().add(new EntityItem(event.getEntityLiving().worldObj, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(Items.BLAZE_POWDER, 6)));
|
||||
@@ -104,4 +107,10 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
|
||||
return LexiconData.gardenOfGlass;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, 0, getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.NORTH));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,10 +64,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
|
||||
GameRegistry.addRecipe(new SpecialFloatingFlowerRecipe());
|
||||
RecipeSorter.register("botania:floatingSpecialFlower", SpecialFloatingFlowerRecipe.class, Category.SHAPELESS, "");
|
||||
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
|
||||
.withProperty(BotaniaStateProps.ISLAND_TYPE, IFloatingFlower.IslandType.GRASS)
|
||||
.withProperty(BotaniaStateProps.SUBTILE_ID, "daybloom")
|
||||
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -208,6 +205,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).onBlockAdded(world, pos, state);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).renderHUD(mc, res);
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.BlockSkull;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,7 +23,11 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
import vazkii.botania.common.block.tile.TileGaiaHead;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -33,10 +38,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGaiaHead extends BlockSkull {
|
||||
public class BlockGaiaHead extends BlockSkull implements IModelRegister, IRegisterCallback {
|
||||
|
||||
public BlockGaiaHead() {
|
||||
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GAIA_HEAD));
|
||||
ModBlocks.ALL_BLOCKS.add(this);
|
||||
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GAIA_HEAD));
|
||||
setUnlocalizedName(LibBlockNames.GAIA_HEAD);
|
||||
setHardness(1.0F);
|
||||
}
|
||||
@@ -79,4 +85,15 @@ public class BlockGaiaHead extends BlockSkull {
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileGaiaHead();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(FACING, NODROP).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
GameRegistry.register(this);
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,13 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.item.block.ItemBlockMod;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
@@ -36,17 +40,17 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockGhostRail extends BlockRailBase implements ILexiconable {
|
||||
public class BlockGhostRail extends BlockRailBase implements ILexiconable, IRegisterCallback, IModelRegister {
|
||||
|
||||
private static final String TAG_FLOAT_TICKS = "Botania_FloatTicks";
|
||||
|
||||
public BlockGhostRail() {
|
||||
super(true);
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GHOST_RAIL));
|
||||
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
|
||||
ModBlocks.ALL_BLOCKS.add(this);
|
||||
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GHOST_RAIL));
|
||||
setUnlocalizedName(LibBlockNames.GHOST_RAIL);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(BlockGhostRail.class);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.RAIL_DIRECTION, EnumRailDirection.NORTH_SOUTH));
|
||||
}
|
||||
|
||||
@@ -68,14 +72,14 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMinecartUpdate(MinecartUpdateEvent event) {
|
||||
public static void onMinecartUpdate(MinecartUpdateEvent event) {
|
||||
BlockPos entPos = new BlockPos(event.getEntity());
|
||||
IBlockState state = event.getEntity().worldObj.getBlockState(entPos);
|
||||
Block block = state.getBlock();
|
||||
boolean air = block.isAir(state, event.getEntity().worldObj, entPos);
|
||||
int floatTicks = event.getEntity().getEntityData().getInteger(TAG_FLOAT_TICKS);
|
||||
|
||||
if(block == this)
|
||||
if(block == ModBlocks.ghostRail)
|
||||
event.getEntity().getEntityData().setInteger(TAG_FLOAT_TICKS, 20);
|
||||
else if(block instanceof BlockRailBase || block == ModBlocks.dreamwood) {
|
||||
event.getEntity().getEntityData().setInteger(TAG_FLOAT_TICKS, 0);
|
||||
@@ -108,4 +112,16 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
|
||||
public IProperty<EnumRailDirection> getShapeProperty() {
|
||||
return BlockRailPowered.SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
GameRegistry.register(this);
|
||||
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerCustomItemblock(this, "ghost_rail");
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,10 @@ import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -29,6 +31,10 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -37,6 +43,7 @@ import vazkii.botania.api.mana.IManaTrigger;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.wand.IWandHUD;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.tile.TileHourglass;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
@@ -184,6 +191,7 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
TileHourglass tile = (TileHourglass) world.getTileEntity(pos);
|
||||
@@ -195,4 +203,12 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
|
||||
return LexiconData.hourglass;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build());
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileHourglass.class);
|
||||
ModelHandler.registerCustomItemblock(this, "hovering_hourglass");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,11 +26,14 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.LuminizerVariant;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.tile.TileLightRelay;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
@@ -85,6 +88,7 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for(int i = 0; i < 2; i++)
|
||||
@@ -170,4 +174,12 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
|
||||
return LexiconData.luminizerTransport;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
int i = 0;
|
||||
for(LuminizerVariant v : LuminizerVariant.values())
|
||||
ModelHandler.registerBlockToState(this, i++, getDefaultState().withProperty(BotaniaStateProps.LUMINIZER_VARIANT, v));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,10 +22,13 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.LivingRockVariant;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -73,6 +76,7 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
|
||||
for(int i = 0; i < LivingRockVariant.values().length; i++)
|
||||
@@ -91,4 +95,10 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
|
||||
return isDefaultVariant ? LexiconData.pureDaisy : LexiconData.decorativeBlocks;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, LivingRockVariant.values().length);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,10 +23,13 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.LivingWoodVariant;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -77,6 +80,7 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
|
||||
for(int i = 0; i < LivingWoodVariant.values().length; i++)
|
||||
@@ -107,4 +111,10 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
|
||||
return state.getValue(BotaniaStateProps.LIVINGWOOD_VARIANT) == LivingWoodVariant.DEFAULT;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, LivingWoodVariant.values().length);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,9 +12,14 @@ package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.recipe.IElvenItem;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.item.block.ItemBlockElven;
|
||||
import vazkii.botania.common.item.block.ItemBlockMod;
|
||||
@@ -22,13 +27,13 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockMod extends Block {
|
||||
public class BlockMod extends Block implements IModelRegister, IRegisterCallback {
|
||||
|
||||
public BlockMod(Material par2Material, String name) {
|
||||
super(par2Material);
|
||||
setUnlocalizedName(name);
|
||||
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, name));
|
||||
registerItemForm();
|
||||
ModBlocks.ALL_BLOCKS.add(this);
|
||||
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
|
||||
if(registerInCreative())
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
}
|
||||
@@ -41,4 +46,16 @@ public class BlockMod extends Block {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
if(Item.getItemFromBlock(this) != null)
|
||||
ModelHandler.registerBlockToState(this, 0, getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
GameRegistry.register(this);
|
||||
registerItemForm();
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -30,12 +31,14 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
@@ -49,7 +52,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable {
|
||||
public abstract class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable, IRegisterCallback, IModelRegister {
|
||||
private static final int COUNT = 8;
|
||||
|
||||
private final boolean second;
|
||||
@@ -59,8 +62,8 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
|
||||
this.setHardness(0.0F);
|
||||
this.setSoundType(SoundType.PLANT);
|
||||
String name = LibBlockNames.DOUBLE_FLOWER + (second ? 2 : 1);
|
||||
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, name));
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
ModBlocks.ALL_BLOCKS.add(this);
|
||||
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
|
||||
setUnlocalizedName(name);
|
||||
setHardness(0F);
|
||||
setTickRandomly(false);
|
||||
@@ -186,7 +189,7 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
|
||||
int b = (hex & 0xFF);
|
||||
|
||||
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency)
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
|
||||
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
|
||||
|
||||
}
|
||||
|
||||
@@ -218,4 +221,16 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
|
||||
return new ItemStack(Item.getItemFromBlock(state.getBlock()), 1, state.getValue(prop).ordinal() - (second ? 8 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void register() {
|
||||
GameRegistry.register(this);
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.FACING).build());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,10 @@ import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -42,4 +45,11 @@ public class BlockModDoubleFlower1 extends BlockModDoubleFlower {
|
||||
meta &= -9;
|
||||
return getDefaultState().withProperty(HALF, half).withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, EnumDyeColor.byMetadata(meta));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
super.registerModels();
|
||||
ModelHandler.registerCustomItemblock(this, 8, i -> "double_flower_" + EnumDyeColor.byMetadata(i).getName());
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,10 @@ import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -43,4 +46,11 @@ public class BlockModDoubleFlower2 extends BlockModDoubleFlower {
|
||||
meta &= -9;
|
||||
return getDefaultState().withProperty(HALF, half).withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2, EnumDyeColor.byMetadata(meta + 8));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
super.registerModels();
|
||||
ModelHandler.registerCustomItemblock(this, 8, i -> "double_flower_" + EnumDyeColor.byMetadata(i + 8).getName());
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -29,10 +30,15 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.achievement.IPickupAchievement;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
@@ -47,7 +53,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable {
|
||||
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable, IRegisterCallback, IModelRegister {
|
||||
|
||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.3, 0, 0.3, 0.8, 1, 0.8);
|
||||
|
||||
@@ -57,8 +63,8 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
|
||||
|
||||
protected BlockModFlower(String name) {
|
||||
setUnlocalizedName(name);
|
||||
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, name));
|
||||
registerItemForm();
|
||||
ModBlocks.ALL_BLOCKS.add(this);
|
||||
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
|
||||
setHardness(0F);
|
||||
setSoundType(SoundType.PLANT);
|
||||
setTickRandomly(false);
|
||||
@@ -112,6 +118,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, @Nonnull List<ItemStack> stacks) {
|
||||
for(int i = 0; i < 16; i++)
|
||||
@@ -123,6 +130,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
int hex = state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
|
||||
@@ -131,7 +139,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
|
||||
int b = (hex & 0xFF);
|
||||
|
||||
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency)
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
|
||||
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,4 +173,16 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
|
||||
world.setBlockState(pos.up(), flower.getDefaultState().withProperty(color.getMetadata() >= 8 ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, color).withProperty(BlockDoublePlant.HALF, BlockDoublePlant.EnumBlockHalf.UPPER), flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
GameRegistry.register(this);
|
||||
registerItemForm();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, (new StateMap.Builder()).ignore(getTypeProperty()).build());
|
||||
ModelHandler.registerCustomItemblock(this, EnumDyeColor.values().length, i -> "flower_" + EnumDyeColor.byMetadata(i).getName());
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
@@ -37,6 +39,7 @@ import vazkii.botania.api.state.enums.CratePattern;
|
||||
import vazkii.botania.api.state.enums.CrateVariant;
|
||||
import vazkii.botania.api.wand.IWandHUD;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.tile.TileCraftCrate;
|
||||
import vazkii.botania.common.block.tile.TileOpenCrate;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
@@ -98,6 +101,7 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
|
||||
for(int i = 0; i < CrateVariant.values().length; i++)
|
||||
@@ -153,6 +157,7 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
|
||||
return crate.onWanded(world, player, stack);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
@@ -188,4 +193,11 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, 0, getDefaultState());
|
||||
ModelHandler.registerBlockToState(this, 1, getDefaultState().withProperty(BotaniaStateProps.CRATE_VARIANT, CrateVariant.CRAFTY));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -27,16 +28,20 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.mana.IManaCollisionGhost;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.PlatformVariant;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.tile.TileCamo;
|
||||
import vazkii.botania.common.block.tile.TilePlatform;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
@@ -53,11 +58,7 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setSoundType(SoundType.WOOD);
|
||||
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
|
||||
.withProperty(BotaniaStateProps.HELD_STATE, null)
|
||||
.withProperty(BotaniaStateProps.HELD_WORLD, null)
|
||||
.withProperty(BotaniaStateProps.HELD_POS, null)
|
||||
.withProperty(BotaniaStateProps.PLATFORM_VARIANT, PlatformVariant.ABSTRUSE));
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.PLATFORM_VARIANT, PlatformVariant.ABSTRUSE));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -111,6 +112,7 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
|
||||
for(int i = 0; i < PlatformVariant.values().length; i++)
|
||||
@@ -152,4 +154,13 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
|
||||
public boolean isGhost(IBlockState state, World world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, 3);
|
||||
// Statemapper after item registration, because the items should be registered to the actual variant names
|
||||
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(BotaniaStateProps.PLATFORM_VARIANT).build());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,14 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import thaumcraft.api.crafting.IInfusionStabiliser;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.PylonVariant;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.tile.TilePylon;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
@@ -90,6 +93,7 @@ public class BlockPylon extends BlockMod implements ILexiconable, IInfusionStabi
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs par2, List<ItemStack> par3) {
|
||||
for(int i = 0; i < PylonVariant.values().length; i++)
|
||||
@@ -143,4 +147,10 @@ public class BlockPylon extends BlockMod implements ILexiconable, IInfusionStabi
|
||||
public boolean canStabaliseInfusion(World world, BlockPos pos) {
|
||||
return ConfigHandler.enableThaumcraftStablizers;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, PylonVariant.values().length);
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,11 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSolidVines extends BlockVine implements ILexiconable {
|
||||
public class BlockSolidVines extends BlockVine implements ILexiconable, IRegisterCallback {
|
||||
|
||||
public BlockSolidVines() {
|
||||
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SOLID_VINE));
|
||||
ModBlocks.ALL_BLOCKS.add(this);
|
||||
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SOLID_VINE));
|
||||
setUnlocalizedName(LibBlockNames.SOLID_VINE);
|
||||
setHardness(0.5F);
|
||||
setSoundType(SoundType.PLANT);
|
||||
@@ -66,4 +67,8 @@ public class BlockSolidVines extends BlockVine implements ILexiconable {
|
||||
return LexiconData.vineBall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
GameRegistry.register(this);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
|
||||
|
||||
pstack.stackSize--;
|
||||
if(pstack.stackSize == 0)
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
player.setHeldItem(hand, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
@@ -18,8 +17,7 @@ import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.client.particle.ParticleDigging;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -31,14 +29,13 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
@@ -53,6 +50,9 @@ import vazkii.botania.api.subtile.ISpecialFlower;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.wand.IWandHUD;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.TileSpecialFlower;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
@@ -65,7 +65,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, IWandable, ILexiconable, IWandHUD {
|
||||
public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, IWandable, ILexiconable, IWandHUD, IRegisterCallback, IModelRegister {
|
||||
|
||||
static {
|
||||
BotaniaAPI.subtilesForCreativeMenu.addAll(Arrays.asList(
|
||||
@@ -121,16 +121,14 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.3, 0, 0.3, 0.8, 1, 0.8);
|
||||
|
||||
protected BlockSpecialFlower() {
|
||||
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SPECIAL_FLOWER));
|
||||
GameRegistry.register(new ItemBlockSpecialFlower(this), getRegistryName());
|
||||
ModBlocks.ALL_BLOCKS.add(this);
|
||||
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SPECIAL_FLOWER));
|
||||
setUnlocalizedName(LibBlockNames.SPECIAL_FLOWER);
|
||||
setHardness(0.1F);
|
||||
setSoundType(SoundType.PLANT);
|
||||
setTickRandomly(false);
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
|
||||
.withProperty(BotaniaStateProps.SUBTILE_ID, "daybloom")
|
||||
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY)
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -170,7 +168,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
if (meta > 15) {
|
||||
meta = 0;
|
||||
}
|
||||
return getDefaultState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.byMetadata(meta)).withProperty(type, EnumFlowerType.POPPY);
|
||||
return getDefaultState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.byMetadata(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,12 +204,14 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, @Nonnull List<ItemStack> stacks) {
|
||||
for(String s : BotaniaAPI.subtilesForCreativeMenu) {
|
||||
@@ -338,43 +338,23 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
return ((TileSpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, stack, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLandingEffects(IBlockState state, net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) {
|
||||
float f = (float) MathHelper.ceiling_float_int(entity.fallDistance - 3.0F);
|
||||
double d0 = (double)Math.min(0.2F + f / 15.0F, 10.0F);
|
||||
if (d0 > 2.5D) {
|
||||
d0 = 2.5D;
|
||||
}
|
||||
int i = (int)(150.0D * d0);
|
||||
worldObj.spawnParticle(EnumParticleTypes.BLOCK_DUST, entity.posX, entity.posY, entity.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, Block.getStateId(Blocks.WATERLILY.getDefaultState()));
|
||||
return true;
|
||||
public void register() {
|
||||
GameRegistry.register(this);
|
||||
GameRegistry.register(new ItemBlockSpecialFlower(this), getRegistryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager effectRenderer) {
|
||||
if (world.getBlockState(pos).getBlock() == this) {
|
||||
int i = 4;
|
||||
ParticleDigging.Factory factory = new ParticleDigging.Factory();
|
||||
for (int j = 0; j < i; ++j) {
|
||||
for (int k = 0; k < i; ++k) {
|
||||
for (int l = 0; l < i; ++l) {
|
||||
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
|
||||
double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
|
||||
double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
|
||||
effectRenderer.addEffect(factory.getEntityFX(-1, world, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, Block.getStateId(Blocks.WATERLILY.getDefaultState())));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void registerModels() {
|
||||
// Let custom loader work
|
||||
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).ignore(getTypeProperty()).build());
|
||||
ModelHandler.registerInventoryVariant(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,10 +22,13 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.StorageVariant;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.item.block.ItemBlockStorage;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -63,6 +66,7 @@ public class BlockStorage extends BlockMod implements ILexiconable {
|
||||
return getDefaultState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.values()[meta]);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs par2, List<ItemStack> par3) {
|
||||
for(int i = 0; i < StorageVariant.values().length; i++)
|
||||
@@ -90,4 +94,10 @@ public class BlockStorage extends BlockMod implements ILexiconable {
|
||||
return variant == StorageVariant.MANASTEEL ? LexiconData.pool : LexiconData.terrasteel;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, StorageVariant.values().length);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,8 +26,12 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -138,4 +142,11 @@ public class BlockTeruTeruBozu extends BlockMod implements ILexiconable {
|
||||
return LexiconData.teruTeruBozu;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerCustomItemblock(this, "teru_teru_bozu");
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileTeruTeruBozu.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
public interface IRegisterCallback {
|
||||
/**
|
||||
* Register block and any itemblocks
|
||||
*/
|
||||
void register();
|
||||
}
|
||||
@@ -34,21 +34,16 @@ import vazkii.botania.common.block.decor.BlockBuriedPetals;
|
||||
import vazkii.botania.common.block.decor.BlockCustomBrick;
|
||||
import vazkii.botania.common.block.decor.BlockDirtPath;
|
||||
import vazkii.botania.common.block.decor.BlockElfGlass;
|
||||
import vazkii.botania.common.block.decor.BlockEndStoneBrick;
|
||||
import vazkii.botania.common.block.decor.BlockFloatingFlower;
|
||||
import vazkii.botania.common.block.decor.BlockManaBeacon;
|
||||
import vazkii.botania.common.block.decor.BlockManaFlame;
|
||||
import vazkii.botania.common.block.decor.BlockManaGlass;
|
||||
import vazkii.botania.common.block.decor.BlockModMushroom;
|
||||
import vazkii.botania.common.block.decor.BlockPetalBlock;
|
||||
import vazkii.botania.common.block.decor.BlockPrismarine;
|
||||
import vazkii.botania.common.block.decor.BlockReeds;
|
||||
import vazkii.botania.common.block.decor.BlockSeaLamp;
|
||||
import vazkii.botania.common.block.decor.BlockShimmerrock;
|
||||
import vazkii.botania.common.block.decor.BlockShimmerwoodPlanks;
|
||||
import vazkii.botania.common.block.decor.BlockShinyFlower;
|
||||
import vazkii.botania.common.block.decor.BlockStarfield;
|
||||
import vazkii.botania.common.block.decor.BlockThatch;
|
||||
import vazkii.botania.common.block.decor.BlockTinyPotato;
|
||||
import vazkii.botania.common.block.decor.BlockUnstable;
|
||||
import vazkii.botania.common.block.dispenser.BehaviourFelPumpkin;
|
||||
@@ -180,8 +175,12 @@ import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibOreDict;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public final class ModBlocks {
|
||||
|
||||
public static final Set<Block> ALL_BLOCKS = new HashSet<>();
|
||||
public static Block flower;
|
||||
public static Block altar;
|
||||
public static Block livingrock;
|
||||
@@ -213,13 +212,9 @@ public final class ModBlocks {
|
||||
public static Block bifrost;
|
||||
public static Block solidVines;
|
||||
public static Block buriedPetals;
|
||||
public static Block prismarine;
|
||||
public static Block seaLamp;
|
||||
public static Block floatingFlower;
|
||||
public static Block tinyPotato;
|
||||
public static Block spawnerClaw;
|
||||
public static Block reedBlock;
|
||||
public static Block thatch;
|
||||
public static Block customBrick;
|
||||
public static Block enderEye;
|
||||
public static Block starfield;
|
||||
@@ -241,7 +236,6 @@ public final class ModBlocks {
|
||||
public static Block petalBlock;
|
||||
public static Block corporeaIndex;
|
||||
public static Block corporeaFunnel;
|
||||
public static Block endStoneBrick;
|
||||
public static Block mushroom;
|
||||
public static Block pump;
|
||||
public static Block doubleFlower1;
|
||||
@@ -305,13 +299,9 @@ public final class ModBlocks {
|
||||
bifrost = new BlockBifrost();
|
||||
solidVines = new BlockSolidVines();
|
||||
buriedPetals = new BlockBuriedPetals();
|
||||
prismarine = new BlockPrismarine();
|
||||
seaLamp = new BlockSeaLamp();
|
||||
floatingFlower = new BlockFloatingFlower();
|
||||
tinyPotato = new BlockTinyPotato();
|
||||
spawnerClaw = new BlockSpawnerClaw();
|
||||
reedBlock = new BlockReeds();
|
||||
thatch = new BlockThatch();
|
||||
customBrick = new BlockCustomBrick();
|
||||
enderEye = new BlockEnderEye();
|
||||
starfield = new BlockStarfield();
|
||||
@@ -333,7 +323,6 @@ public final class ModBlocks {
|
||||
petalBlock = new BlockPetalBlock();
|
||||
corporeaIndex = new BlockCorporeaIndex();
|
||||
corporeaFunnel = new BlockCorporeaFunnel();
|
||||
endStoneBrick = new BlockEndStoneBrick();
|
||||
mushroom = new BlockModMushroom();
|
||||
pump = new BlockPump();
|
||||
doubleFlower1 = new BlockModDoubleFlower1();
|
||||
@@ -367,6 +356,14 @@ public final class ModBlocks {
|
||||
|
||||
ModFluffBlocks.init();
|
||||
|
||||
for (Block b : ALL_BLOCKS) {
|
||||
if (b instanceof IRegisterCallback) {
|
||||
((IRegisterCallback) b).register();
|
||||
} else {
|
||||
throw new RuntimeException(b.getRegistryName() + " doesn't have register callbacks!");
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 16; i++)
|
||||
OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower, 1, i));
|
||||
|
||||
|
||||
@@ -11,14 +11,11 @@
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.BiomeBrickVariant;
|
||||
import vazkii.botania.api.state.enums.BiomeStoneVariant;
|
||||
import vazkii.botania.api.state.enums.FutureStoneVariant;
|
||||
import vazkii.botania.common.block.decor.Block18Stone;
|
||||
import vazkii.botania.common.block.decor.BlockPavement;
|
||||
import vazkii.botania.common.block.decor.biomestone.BlockBiomeStoneA;
|
||||
import vazkii.botania.common.block.decor.biomestone.BlockBiomeStoneB;
|
||||
@@ -28,15 +25,10 @@ import vazkii.botania.common.block.decor.panes.BlockManaglassPane;
|
||||
import vazkii.botania.common.block.decor.quartz.BlockSpecialQuartz;
|
||||
import vazkii.botania.common.block.decor.quartz.BlockSpecialQuartzSlab;
|
||||
import vazkii.botania.common.block.decor.quartz.BlockSpecialQuartzStairs;
|
||||
import vazkii.botania.common.block.decor.slabs.Block18StoneSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockBiomeStoneSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockDirtPathSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockEndStoneSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockEnderBrickSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockModSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockPavementSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockReedSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockThatchSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.bricks.BlockCustomBrickSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.bricks.BlockSnowBrickSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.bricks.BlockSoulBrickSlab;
|
||||
@@ -49,16 +41,8 @@ import vazkii.botania.common.block.decor.slabs.living.BlockLivingwoodPlankSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.living.BlockLivingwoodSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.living.BlockShimmerrockSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.living.BlockShimmerwoodPlankSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.prismarine.BlockDarkPrismarineSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.prismarine.BlockPrismarineBrickSlab;
|
||||
import vazkii.botania.common.block.decor.slabs.prismarine.BlockPrismarineSlab;
|
||||
import vazkii.botania.common.block.decor.stairs.Block18StoneStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.BlockBiomeStoneStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.BlockEndStoneStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.BlockEnderBrickStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.BlockPavementStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.BlockReedStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.BlockThatchStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.bricks.BlockCustomBrickStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.bricks.BlockSnowBrickStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.bricks.BlockSoulBrickStairs;
|
||||
@@ -71,13 +55,7 @@ import vazkii.botania.common.block.decor.stairs.living.BlockLivingwoodPlankStair
|
||||
import vazkii.botania.common.block.decor.stairs.living.BlockLivingwoodStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.living.BlockShimmerrockStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.living.BlockShimmerwoodPlankStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.prismarine.BlockDarkPrismarineStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.prismarine.BlockPrismarineBrickStairs;
|
||||
import vazkii.botania.common.block.decor.stairs.prismarine.BlockPrismarineStairs;
|
||||
import vazkii.botania.common.block.decor.walls.Block18StoneWall;
|
||||
import vazkii.botania.common.block.decor.walls.BlockBiomeStoneWall;
|
||||
import vazkii.botania.common.block.decor.walls.BlockPrismarineWall;
|
||||
import vazkii.botania.common.block.decor.walls.BlockReedWall;
|
||||
import vazkii.botania.common.block.decor.walls.living.BlockDreamwoodWall;
|
||||
import vazkii.botania.common.block.decor.walls.living.BlockLivingrockWall;
|
||||
import vazkii.botania.common.block.decor.walls.living.BlockLivingwoodWall;
|
||||
@@ -85,7 +63,6 @@ import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
public final class ModFluffBlocks {
|
||||
|
||||
@@ -111,25 +88,6 @@ public final class ModFluffBlocks {
|
||||
public static Block dreamwoodPlankSlab;
|
||||
public static Block dreamwoodPlankSlabFull;
|
||||
|
||||
public static Block prismarineStairs;
|
||||
public static Block prismarineSlab;
|
||||
public static Block prismarineSlabFull;
|
||||
public static Block prismarineWall;
|
||||
public static Block prismarineBrickStairs;
|
||||
public static Block prismarineBrickSlab;
|
||||
public static Block prismarineBrickSlabFull;
|
||||
public static Block darkPrismarineStairs;
|
||||
public static Block darkPrismarineSlab;
|
||||
public static Block darkPrismarineSlabFull;
|
||||
|
||||
public static Block reedStairs;
|
||||
public static Block reedSlab;
|
||||
public static Block reedSlabFull;
|
||||
public static Block reedWall;
|
||||
public static Block thatchStairs;
|
||||
public static Block thatchSlab;
|
||||
public static Block thatchSlabFull;
|
||||
|
||||
public static Block netherBrickStairs;
|
||||
public static Block netherBrickSlab;
|
||||
public static Block netherBrickSlabFull;
|
||||
@@ -177,7 +135,6 @@ public final class ModFluffBlocks {
|
||||
|
||||
public static Block biomeStoneA;
|
||||
public static Block biomeStoneB;
|
||||
public static Block stone;
|
||||
public static Block pavement;
|
||||
|
||||
public static final Block[] biomeStoneStairs = new Block[24];
|
||||
@@ -185,22 +142,10 @@ public final class ModFluffBlocks {
|
||||
public static final Block[] biomeStoneFullSlabs = new Block[24];
|
||||
public static Block biomeStoneWall;
|
||||
|
||||
public static final Block[] stoneStairs = new Block[8];
|
||||
public static final Block[] stoneSlabs = new Block[8];
|
||||
public static final Block[] stoneFullSlabs = new Block[8];
|
||||
public static Block stoneWall;
|
||||
|
||||
public static final Block[] pavementStairs = new Block[BlockPavement.TYPES];
|
||||
public static final Block[] pavementSlabs = new Block[BlockPavement.TYPES];
|
||||
public static final Block[] pavementFullSlabs = new Block[BlockPavement.TYPES];
|
||||
|
||||
public static Block endStoneSlab;
|
||||
public static Block endStoneSlabFull;
|
||||
public static Block endStoneStairs;
|
||||
public static Block enderBrickSlab;
|
||||
public static Block enderBrickSlabFull;
|
||||
public static Block enderBrickStairs;
|
||||
|
||||
public static Block shimmerrockSlab;
|
||||
public static Block shimmerrockSlabFull;
|
||||
public static Block shimmerrockStairs;
|
||||
@@ -235,25 +180,6 @@ public final class ModFluffBlocks {
|
||||
dreamwoodPlankSlab = new BlockDreamwoodPlankSlab(false);
|
||||
dreamwoodPlankSlabFull = new BlockDreamwoodPlankSlab(true);
|
||||
|
||||
prismarineStairs = new BlockPrismarineStairs();
|
||||
prismarineSlab = new BlockPrismarineSlab(false);
|
||||
prismarineSlabFull = new BlockPrismarineSlab(true);
|
||||
prismarineWall = new BlockPrismarineWall();
|
||||
prismarineBrickStairs = new BlockPrismarineBrickStairs();
|
||||
prismarineBrickSlab = new BlockPrismarineBrickSlab(false);
|
||||
prismarineBrickSlabFull = new BlockPrismarineBrickSlab(true);
|
||||
darkPrismarineStairs = new BlockDarkPrismarineStairs();
|
||||
darkPrismarineSlab = new BlockDarkPrismarineSlab(false);
|
||||
darkPrismarineSlabFull = new BlockDarkPrismarineSlab(true);
|
||||
|
||||
reedStairs = new BlockReedStairs();
|
||||
reedSlab = new BlockReedSlab(false);
|
||||
reedSlabFull = new BlockReedSlab(true);
|
||||
reedWall = new BlockReedWall();
|
||||
thatchStairs = new BlockThatchStairs();
|
||||
thatchSlab = new BlockThatchSlab(false);
|
||||
thatchSlabFull = new BlockThatchSlab(true);
|
||||
|
||||
netherBrickStairs = new BlockCustomBrickStairs();
|
||||
netherBrickSlab = new BlockCustomBrickSlab(false);
|
||||
netherBrickSlabFull = new BlockCustomBrickSlab(true);
|
||||
@@ -269,7 +195,6 @@ public final class ModFluffBlocks {
|
||||
|
||||
biomeStoneA = new BlockBiomeStoneA();
|
||||
biomeStoneB = new BlockBiomeStoneB();
|
||||
stone = new Block18Stone();
|
||||
pavement = new BlockPavement();
|
||||
|
||||
if(ConfigHandler.darkQuartzEnabled) {
|
||||
@@ -327,24 +252,6 @@ public final class ModFluffBlocks {
|
||||
}
|
||||
biomeStoneWall = new BlockBiomeStoneWall();
|
||||
|
||||
Set<FutureStoneVariant> allowed = ImmutableSet.of(FutureStoneVariant.ANDESITE, FutureStoneVariant.ANDESITE_BRICK,
|
||||
FutureStoneVariant.BASALT, FutureStoneVariant.BASALT_BRICK, FutureStoneVariant.DIORITE, FutureStoneVariant.DIORITE_BRICK,
|
||||
FutureStoneVariant.GRANITE, FutureStoneVariant.GRANITE_BRICK);
|
||||
|
||||
count = 0;
|
||||
for(FutureStoneVariant variant : FutureStoneVariant.values()) {
|
||||
if (!allowed.contains(variant)) {
|
||||
// Filter - only get the base blocks, and the brick versions
|
||||
continue;
|
||||
}
|
||||
|
||||
stoneStairs[count] = new Block18StoneStairs(variant);
|
||||
stoneSlabs[count] = new Block18StoneSlab(false, variant, count);
|
||||
stoneFullSlabs[count] = new Block18StoneSlab(true, variant, count);
|
||||
count++;
|
||||
}
|
||||
stoneWall = new Block18StoneWall();
|
||||
|
||||
count = 0;
|
||||
for (EnumDyeColor color : ImmutableList.of(EnumDyeColor.WHITE, EnumDyeColor.BLACK, EnumDyeColor.BLUE,
|
||||
EnumDyeColor.RED, EnumDyeColor.YELLOW, EnumDyeColor.GREEN)) {
|
||||
@@ -354,13 +261,6 @@ public final class ModFluffBlocks {
|
||||
count++;
|
||||
}
|
||||
|
||||
endStoneSlab = new BlockEndStoneSlab(false);
|
||||
endStoneSlabFull = new BlockEndStoneSlab(true);
|
||||
endStoneStairs = new BlockEndStoneStairs();
|
||||
enderBrickSlab = new BlockEnderBrickSlab(false);
|
||||
enderBrickSlabFull = new BlockEnderBrickSlab(true);
|
||||
enderBrickStairs = new BlockEnderBrickStairs();
|
||||
|
||||
shimmerrockSlab = new BlockShimmerrockSlab(false);
|
||||
shimmerrockSlabFull = new BlockShimmerrockSlab(true);
|
||||
shimmerrockStairs = new BlockShimmerrockStairs();
|
||||
@@ -371,85 +271,6 @@ public final class ModFluffBlocks {
|
||||
managlassPane = new BlockManaglassPane();
|
||||
alfglassPane = new BlockAlfglassPane();
|
||||
bifrostPane = new BlockBifrostPane();
|
||||
|
||||
if(ConfigHandler.darkQuartzEnabled) {
|
||||
((BlockModSlab) darkQuartzSlab).register();
|
||||
((BlockModSlab) darkQuartzSlabFull).register();
|
||||
}
|
||||
((BlockModSlab) manaQuartzSlab).register();
|
||||
((BlockModSlab) manaQuartzSlabFull).register();
|
||||
((BlockModSlab) blazeQuartzSlab).register();
|
||||
((BlockModSlab) blazeQuartzSlabFull).register();
|
||||
((BlockModSlab) lavenderQuartzSlab).register();
|
||||
((BlockModSlab) lavenderQuartzSlabFull).register();
|
||||
((BlockModSlab) redQuartzSlab).register();
|
||||
((BlockModSlab) redQuartzSlabFull).register();
|
||||
((BlockModSlab) elfQuartzSlab).register();
|
||||
((BlockModSlab) elfQuartzSlabFull).register();
|
||||
((BlockModSlab) sunnyQuartzSlab).register();
|
||||
((BlockModSlab) sunnyQuartzSlabFull).register();
|
||||
|
||||
((BlockModSlab) livingwoodSlab).register();
|
||||
((BlockModSlab) livingwoodSlabFull).register();
|
||||
((BlockModSlab) livingwoodPlankSlab).register();
|
||||
((BlockModSlab) livingwoodPlankSlabFull).register();
|
||||
((BlockModSlab) livingrockSlab).register();
|
||||
((BlockModSlab) livingrockSlabFull).register();
|
||||
((BlockModSlab) livingrockBrickSlab).register();
|
||||
((BlockModSlab) livingrockBrickSlabFull).register();
|
||||
((BlockModSlab) dreamwoodSlab).register();
|
||||
((BlockModSlab) dreamwoodSlabFull).register();
|
||||
((BlockModSlab) dreamwoodPlankSlab).register();
|
||||
((BlockModSlab) dreamwoodPlankSlabFull).register();
|
||||
|
||||
((BlockModSlab) reedSlab).register();
|
||||
((BlockModSlab) reedSlabFull).register();
|
||||
((BlockModSlab) thatchSlab).register();
|
||||
((BlockModSlab) thatchSlabFull).register();
|
||||
|
||||
((BlockModSlab) prismarineSlab).register();
|
||||
((BlockModSlab) prismarineSlabFull).register();
|
||||
((BlockModSlab) prismarineBrickSlab).register();
|
||||
((BlockModSlab) prismarineBrickSlabFull).register();
|
||||
((BlockModSlab) darkPrismarineSlab).register();
|
||||
((BlockModSlab) darkPrismarineSlabFull).register();
|
||||
|
||||
((BlockModSlab) netherBrickSlab).register();
|
||||
((BlockModSlab) netherBrickSlabFull).register();
|
||||
((BlockModSlab) soulBrickSlab).register();
|
||||
((BlockModSlab) soulBrickSlabFull).register();
|
||||
((BlockModSlab) snowBrickSlab).register();
|
||||
((BlockModSlab) snowBrickSlabFull).register();
|
||||
((BlockModSlab) tileSlab).register();
|
||||
((BlockModSlab) tileSlabFull).register();
|
||||
|
||||
((BlockModSlab) dirtPathSlab).register();
|
||||
((BlockModSlab) dirtPathSlabFull).register();
|
||||
|
||||
((BlockModSlab) endStoneSlab).register();
|
||||
((BlockModSlab) endStoneSlabFull).register();
|
||||
((BlockModSlab) enderBrickSlab).register();
|
||||
((BlockModSlab) enderBrickSlabFull).register();
|
||||
|
||||
((BlockModSlab) shimmerrockSlab).register();
|
||||
((BlockModSlab) shimmerrockSlabFull).register();
|
||||
((BlockModSlab) shimmerwoodPlankSlab).register();
|
||||
((BlockModSlab) shimmerwoodPlankSlabFull).register();
|
||||
|
||||
for(int i = 0; i < 24; i++) {
|
||||
((BlockModSlab) biomeStoneSlabs[i]).register();
|
||||
((BlockModSlab) biomeStoneFullSlabs[i]).register();
|
||||
}
|
||||
|
||||
for(int i = 0; i < 8; i++) {
|
||||
((BlockModSlab) stoneSlabs[i]).register();
|
||||
((BlockModSlab) stoneFullSlabs[i]).register();
|
||||
}
|
||||
|
||||
for(int i = 0; i < pavementSlabs.length; i++) {
|
||||
((BlockModSlab) pavementSlabs[i]).register();
|
||||
((BlockModSlab) pavementFullSlabs[i]).register();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
@@ -23,12 +24,16 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.common.property.Properties;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
@@ -44,7 +49,7 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
super(Material.IRON, LibBlockNames.CORPOREA_CRYSTAL_CUBE);
|
||||
setHardness(5.5F);
|
||||
setSoundType(SoundType.METAL);
|
||||
setDefaultState(((IExtendedBlockState) blockState.getBaseState()).withProperty(Properties.AnimationProperty, null).withProperty(Properties.StaticProperty, true));
|
||||
setDefaultState(blockState.getBaseState().withProperty(Properties.StaticProperty, true));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -125,4 +130,11 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
return ((TileCorporeaCrystalCube) world.getTileEntity(pos)).compValue;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerInventoryVariant(this);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileCorporeaCrystalCube.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,18 +17,21 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.ParticleDigging;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.StorageVariant;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
@@ -108,4 +111,11 @@ public class BlockCorporeaIndex extends BlockCorporeaBase implements ILexiconabl
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerCustomItemblock(this, "corporea_index");
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileCorporeaIndex.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's 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
|
||||
*
|
||||
* File Created @ [Apr 10, 2015, 7:34:31 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.decor;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.FutureStoneVariant;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class Block18Stone extends BlockMod implements ILexiconable {
|
||||
|
||||
public Block18Stone() {
|
||||
super(Material.ROCK, LibBlockNames.STONE);
|
||||
setHardness(1.5F);
|
||||
setResistance(10F);
|
||||
setSoundType(SoundType.STONE);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.FUTURESTONE_VARIANT, FutureStoneVariant.ANDESITE));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BotaniaStateProps.FUTURESTONE_VARIANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BotaniaStateProps.FUTURESTONE_VARIANT).ordinal();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta >= FutureStoneVariant.values().length) {
|
||||
meta = 0;
|
||||
}
|
||||
return getDefaultState().withProperty(BotaniaStateProps.FUTURESTONE_VARIANT, FutureStoneVariant.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for(int i = 0; i < 16; i++)
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemForm() {
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, getMetaFromState(world.getBlockState(pos)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
|
||||
return LexiconData.stoneAlchemy;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.block.decor;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
@@ -18,6 +19,9 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.BlockModFlower;
|
||||
@@ -42,6 +46,7 @@ public class BlockBuriedPetals extends BlockModFlower {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
EnumDyeColor color = state.getValue(BotaniaStateProps.COLOR);
|
||||
@@ -51,7 +56,7 @@ public class BlockBuriedPetals extends BlockModFlower {
|
||||
int b = (hex & 0xFF);
|
||||
|
||||
Botania.proxy.setSparkleFXNoClip(true);
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.1 + rand.nextFloat() * 0.1, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
|
||||
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.1 + rand.nextFloat() * 0.1, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
|
||||
|
||||
Botania.proxy.setSparkleFXNoClip(false);
|
||||
}
|
||||
@@ -74,4 +79,11 @@ public class BlockBuriedPetals extends BlockModFlower {
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.INVISIBLE;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, (new StateMap.Builder()).ignore(getTypeProperty()).build());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,10 +22,13 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.CustomBrickVariant;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
@@ -74,6 +77,7 @@ public class BlockCustomBrick extends BlockMod implements ILexiconable {
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
|
||||
for(int i = 0; i < CustomBrickVariant.values().length; i++)
|
||||
@@ -92,4 +96,10 @@ public class BlockCustomBrick extends BlockMod implements ILexiconable {
|
||||
return variant.getName().contains("azulejo") ? LexiconData.azulejo : LexiconData.decorativeBlocks;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, CustomBrickVariant.values().length);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
@@ -53,7 +54,7 @@ public class BlockDirtPath extends BlockMod implements ILexiconable {
|
||||
setHardness(0.6F);
|
||||
setSoundType(SoundType.GROUND);
|
||||
useNeighborBrightness = true;
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(BlockDirtPath.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,11 +114,11 @@ public class BlockDirtPath extends BlockMod implements ILexiconable {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTickEnd(TickEvent.WorldTickEvent event) {
|
||||
public static void onTickEnd(TickEvent.WorldTickEvent event) {
|
||||
if(event.world.isRemote || event.phase != TickEvent.Phase.END)
|
||||
return;
|
||||
for(EntityPlayerMP player : event.world.getPlayers(EntityPlayerMP.class, p -> p.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).hasModifier(speedBoost))) {
|
||||
if (event.world.getBlockState(new BlockPos(player).down()).getBlock() != this) {
|
||||
if (event.world.getBlockState(new BlockPos(player).down()).getBlock() != ModBlocks.dirtPath) {
|
||||
player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).removeModifier(speedBoost);
|
||||
}
|
||||
} // todo 1.8 there's probably a better way to do this.
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's 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
|
||||
*
|
||||
* File Created @ [Feb 16, 2015, 8:17:12 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.decor;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.EndBrickVariant;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockEndStoneBrick extends BlockMod implements ILexiconable {
|
||||
|
||||
public BlockEndStoneBrick() {
|
||||
super(Material.ROCK, LibBlockNames.END_STONE_BRICK);
|
||||
setHardness(1.5F);
|
||||
setResistance(10F);
|
||||
setSoundType(SoundType.STONE);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ENDBRICK_VARIANT, EndBrickVariant.END_STONE_BRICKS));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BotaniaStateProps.ENDBRICK_VARIANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BotaniaStateProps.ENDBRICK_VARIANT).ordinal();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta >= EndBrickVariant.values().length) {
|
||||
meta = 0;
|
||||
}
|
||||
return getDefaultState().withProperty(BotaniaStateProps.ENDBRICK_VARIANT, EndBrickVariant.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for(int i = 0; i < EndBrickVariant.values().length; i++)
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemForm() {
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, getMetaFromState(world.getBlockState(pos)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
|
||||
return LexiconData.endStoneDecor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,32 +10,28 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.decor;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.client.particle.ParticleDigging;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
@@ -50,6 +46,7 @@ import vazkii.botania.api.item.IFloatingFlower.IslandType;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.tile.TileFloatingFlower;
|
||||
@@ -79,9 +76,7 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
|
||||
setSoundType(SoundType.GROUND);
|
||||
setLightLevel(1F);
|
||||
|
||||
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
|
||||
.withProperty(BotaniaStateProps.ISLAND_TYPE, IslandType.GRASS)
|
||||
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -93,7 +88,13 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||
return ConfigHandler.staticFloaters ? EnumBlockRenderType.MODEL : EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -129,40 +130,6 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLandingEffects(IBlockState state, net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) {
|
||||
float f = (float) MathHelper.ceiling_float_int(entity.fallDistance - 3.0F);
|
||||
double d0 = (double)Math.min(0.2F + f / 15.0F, 10.0F);
|
||||
if (d0 > 2.5D) {
|
||||
d0 = 2.5D;
|
||||
}
|
||||
int i = (int)(150.0D * d0);
|
||||
worldObj.spawnParticle(EnumParticleTypes.BLOCK_DUST, entity.posX, entity.posY, entity.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, Block.getStateId(Blocks.DIRT.getDefaultState()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager effectRenderer) {
|
||||
if (world.getBlockState(pos).getBlock() == this) {
|
||||
int i = 4;
|
||||
ParticleDigging.Factory factory = new ParticleDigging.Factory();
|
||||
for (int j = 0; j < i; ++j) {
|
||||
for (int k = 0; k < i; ++k) {
|
||||
for (int l = 0; l < i; ++l) {
|
||||
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
|
||||
double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
|
||||
double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
|
||||
effectRenderer.addEffect(factory.getEntityFX(-1, world, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, Block.getStateId(Blocks.DIRT.getDefaultState())));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemForm() {
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
@@ -177,7 +144,7 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
|
||||
int b = (hex & 0xFF);
|
||||
|
||||
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency)
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
|
||||
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -249,4 +216,12 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
|
||||
public boolean canStabaliseInfusion(World world, BlockPos pos) {
|
||||
return ConfigHandler.enableThaumcraftStablizers;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).build());
|
||||
// All to variant inventory so smartmodel can work
|
||||
ModelHandler.registerItemAllMeta(Item.getItemFromBlock(this), EnumDyeColor.values().length);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
@@ -24,10 +25,14 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.tile.TileManaBeacon;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetaNameAndColor;
|
||||
@@ -75,6 +80,7 @@ public class BlockManaBeacon extends BlockMod implements ILexiconable {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
|
||||
for(int i = 0; i < 16; i++)
|
||||
@@ -116,4 +122,11 @@ public class BlockManaBeacon extends BlockMod implements ILexiconable {
|
||||
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
|
||||
return new TileManaBeacon();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelHandler.registerBlockToState(this, EnumDyeColor.values().length);
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public class BlockManaFlame extends BlockMod implements ILexiconable {
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos) {
|
||||
return null;
|
||||
return NULL_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,8 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
@@ -47,12 +49,14 @@ public class BlockManaGlass extends BlockMod implements ILexiconable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side) {
|
||||
Block block = world.getBlockState(pos.offset(side)).getBlock();
|
||||
return block == this ? false : super.shouldSideBeRendered(state, world, pos, side);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
|
||||
@@ -37,7 +37,11 @@ import vazkii.botania.api.item.IHornHarvestable;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.IRegisterCallback;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
@@ -50,13 +54,13 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.crafting.IInfusionStabiliser", striprefs = true)
|
||||
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IHornHarvestable, ILexiconable {
|
||||
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IHornHarvestable, ILexiconable, IRegisterCallback, IModelRegister {
|
||||
|
||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.3, 0, 0.3, 0.8, 1, 0.8);
|
||||
|
||||
public BlockModMushroom() {
|
||||
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.MUSHROOM));
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
ModBlocks.ALL_BLOCKS.add(this);
|
||||
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.MUSHROOM));
|
||||
setUnlocalizedName(LibBlockNames.MUSHROOM);
|
||||
setLightLevel(0.2F);
|
||||
setHardness(0F);
|
||||
@@ -127,7 +131,7 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
|
||||
int b = (hex & 0xFF);
|
||||
|
||||
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency * 0.25F)
|
||||
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
|
||||
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,4 +157,15 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
|
||||
@Override
|
||||
public void harvestByHorn(World world, BlockPos pos, ItemStack stack, EnumHornType hornType) {}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
GameRegistry.register(this);
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerCustomItemblock(this, EnumDyeColor.values().length, i -> "mushroom_" + EnumDyeColor.byMetadata(i).getName());
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,10 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -92,6 +95,7 @@ public class BlockPavement extends BlockMod {
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
|
||||
for(int i = 0; i < TYPES; i++)
|
||||
@@ -104,4 +108,10 @@ public class BlockPavement extends BlockMod {
|
||||
return new ItemStack(this, 1, getMetaFromState(world.getBlockState(pos)));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelHandler.registerBlockToState(this, BotaniaStateProps.PAVEMENT_COLOR.getAllowedValues().size());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
@@ -21,10 +22,14 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetaNameAndColor;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
@@ -62,6 +67,7 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
|
||||
return getDefaultState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.byMetadata(meta));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for(int i = 0; i < 16; i++)
|
||||
@@ -83,4 +89,11 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
|
||||
return LexiconData.flowers;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelHandler.registerBlockToState(this, EnumDyeColor.values().length);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's 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
|
||||
*
|
||||
* File Created @ [Jun 28, 2014, 8:25:39 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.decor;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.PrismarineVariant;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPrismarine extends BlockMod implements ILexiconable {
|
||||
|
||||
private static final int TYPES = 3;
|
||||
|
||||
public BlockPrismarine() {
|
||||
super(Material.ROCK, LibBlockNames.PRISMARINE);
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setSoundType(SoundType.STONE);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.PRISMARINE_VARIANT, PrismarineVariant.PRISMARINE));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BotaniaStateProps.PRISMARINE_VARIANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BotaniaStateProps.PRISMARINE_VARIANT).ordinal();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta >= PrismarineVariant.values().length) {
|
||||
meta = 0;
|
||||
}
|
||||
return getDefaultState().withProperty(BotaniaStateProps.PRISMARINE_VARIANT, PrismarineVariant.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemForm() {
|
||||
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
|
||||
for(int i = 0; i < TYPES; i++)
|
||||
stacks.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, getMetaFromState(world.getBlockState(pos)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
|
||||
return LexiconData.prismarine;
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's 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
|
||||
*
|
||||
* File Created @ [Jul 28, 2014, 8:02:49 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.decor;
|
||||
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.item.block.ItemBlockMod;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockReeds extends BlockRotatedPillar implements ILexiconable {
|
||||
|
||||
public BlockReeds() {
|
||||
super(Material.WOOD);
|
||||
setHardness(1.0F);
|
||||
setSoundType(SoundType.WOOD);
|
||||
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.REED_BLOCK));
|
||||
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
|
||||
setUnlocalizedName(LibBlockNames.REED_BLOCK);
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.AXIS_FACING, EnumFacing.Axis.Y));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BotaniaStateProps.AXIS_FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
switch (state.getValue(BotaniaStateProps.AXIS_FACING)) {
|
||||
case Z: return 8;
|
||||
case X: return 4;
|
||||
case Y:
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
EnumFacing.Axis axis;
|
||||
switch (meta) {
|
||||
case 8: axis = EnumFacing.Axis.Z; break;
|
||||
case 4: axis = EnumFacing.Axis.X; break;
|
||||
case 0:
|
||||
default: axis = EnumFacing.Axis.Y; break;
|
||||
}
|
||||
return getDefaultState().withProperty(BotaniaStateProps.AXIS_FACING, axis);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
return getStateFromMeta(meta).withProperty(BotaniaStateProps.AXIS_FACING, facing.getAxis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
|
||||
return LexiconData.decorativeBlocks;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's 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
|
||||
*
|
||||
* File Created @ [Jun 28, 2014, 9:24:43 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.decor;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockSeaLamp extends BlockMod implements ILexiconable {
|
||||
|
||||
public BlockSeaLamp() {
|
||||
super(Material.GLASS, LibBlockNames.SEA_LAMP);
|
||||
setHardness(0.3F);
|
||||
setSoundType(SoundType.GLASS);
|
||||
setLightLevel(1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
|
||||
return LexiconData.prismarine;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,15 +11,21 @@
|
||||
package vazkii.botania.common.block.decor;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import thaumcraft.api.crafting.IInfusionStabiliser;
|
||||
import vazkii.botania.api.item.IHornHarvestable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.client.core.handler.ModelHandler;
|
||||
import vazkii.botania.common.block.BlockModFlower;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
@@ -63,4 +69,11 @@ public class BlockShinyFlower extends BlockModFlower implements IInfusionStabili
|
||||
@Override
|
||||
public void harvestByHorn(World world, BlockPos pos, ItemStack stack, EnumHornType hornType) {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelLoader.setCustomStateMapper(this, (new StateMap.Builder()).ignore(getTypeProperty()).build());
|
||||
ModelHandler.registerCustomItemblock(this, EnumDyeColor.values().length, i -> "glimmering_flower_" + EnumDyeColor.byMetadata(i).getName());
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 1105 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user