mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 02:45:13 +00:00
fix for merge
This commit is contained in:
commit
18dceeeb5f
375 files changed
+5229
-1196
No files matched your search
@@ -88,7 +88,7 @@ public final class BotaniaAPI {
|
||||
public static Map<Item, Block> seeds = new HashMap();
|
||||
|
||||
public static Set<Item> looniumBlacklist = new LinkedHashSet<Item>();
|
||||
public static Map<Block, PropertyEnum> paintableBlocks = new LinkedHashMap<Block, PropertyEnum>();
|
||||
public static Map<Block, PropertyEnum<EnumDyeColor>> paintableBlocks = new LinkedHashMap<Block, PropertyEnum<EnumDyeColor>>();
|
||||
public static Set<String> magnetBlacklist = new LinkedHashSet<String>();
|
||||
|
||||
|
||||
@@ -285,15 +285,9 @@ public final class BotaniaAPI {
|
||||
* You must also provide the PropertyEnum that this block uses to express its color
|
||||
* The component type of the property must be EnumDyeColor
|
||||
*/
|
||||
public static Block registerPaintableBlock(Block paintable, PropertyEnum colorProp){
|
||||
if (colorProp.getValueClass() != EnumDyeColor.class) {
|
||||
throw new IllegalArgumentException("Must be EnumDyeColor");
|
||||
}
|
||||
|
||||
public static Block registerPaintableBlock(Block paintable, PropertyEnum<EnumDyeColor> colorProp){
|
||||
paintableBlocks.put(paintable, colorProp);
|
||||
return paintable;
|
||||
|
||||
//todo 1.8 improve this
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,7 +328,7 @@ public final class BotaniaAPI {
|
||||
}
|
||||
|
||||
public static boolean isBlockBlacklistedFromMagnet(IBlockState state) {
|
||||
return isBlockBlacklistedFromMagnet(state.getBlock(), state.getBlock().getMetaFromState(state), 0);
|
||||
return isBlockBlacklistedFromMagnet(state.getBlock(), state.getBlock().getMetaFromState(state));
|
||||
}
|
||||
|
||||
public static boolean isBlockBlacklistedFromMagnet(Block block, int meta) {
|
||||
|
||||
@@ -13,6 +13,8 @@ package vazkii.botania.api.item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* An item that implements this counts as a Relic item. This is purely for interaction
|
||||
* and other mod items should not implement this interface.
|
||||
@@ -20,14 +22,14 @@ import net.minecraft.stats.Achievement;
|
||||
public interface IRelic {
|
||||
|
||||
/**
|
||||
* Binds to the player name passed in.
|
||||
* Binds to the player UUID passed in.
|
||||
*/
|
||||
public void bindToUsername(String playerName, ItemStack stack);
|
||||
public void bindToUuid(UUID playerName, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the username of the person this relic is bound to.
|
||||
* Gets the UUID of the person this relic is bound to.
|
||||
*/
|
||||
public String getSoulbindUsername(ItemStack stack);
|
||||
public UUID getSoulbindUuid(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Sets the achievement that this relic binds to.
|
||||
|
||||
@@ -18,7 +18,7 @@ import vazkii.botania.api.internal.IManaBurst;
|
||||
*
|
||||
* <b>Implementation Instructions:</b><br>
|
||||
* - Override invalidate() and onChunkUnload(), calling <i>ManaNetworkEvent.removeCollector(this);</i> on both.<br>
|
||||
* - On the first tick of onUpdate(), call </i>ManaNetworkEvent.addCollector(this);<i>
|
||||
* - On the first tick of update() (or onLoad() in Forge build 1606 or higher), call </i>ManaNetworkEvent.addCollector(this);<i>
|
||||
*/
|
||||
public interface IManaCollector extends IManaReceiver {
|
||||
|
||||
|
||||
@@ -0,0 +1,351 @@
|
||||
package vazkii.botania.api.render;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
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.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.client.resources.model.ModelManager;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ICustomModelLoader;
|
||||
import net.minecraftforge.client.model.IFlexibleBakedModel;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.IModelCustomData;
|
||||
import net.minecraftforge.client.model.IModelState;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.ISmartBlockModel;
|
||||
import net.minecraftforge.client.model.ISmartItemModel;
|
||||
import net.minecraftforge.client.model.TRSRTransformation;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
import javax.vecmath.Matrix4f;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SpecialFlowerModel implements IModelCustomData {
|
||||
|
||||
/**
|
||||
* Register your model for the given subtile class here.
|
||||
* Call this DURING PREINIT. Calling it anytime after blockModels have already baked does not guarantee that your model will work.
|
||||
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
|
||||
* Tint is applied whenever a player recolors the flower using floral dye
|
||||
* todo 1.8.8 move this elsewhere or otherwise make it fit better with the rest of the subtile registration process
|
||||
*
|
||||
* @param subTileName The String ID of the subtile
|
||||
* @param model A path to a blockstate json and variant to be used for this subtile
|
||||
* @param itemModel A path to a blockstate json and variant to be used for this subtile's item form
|
||||
*/
|
||||
public static void register(String subTileName, ModelResourceLocation model, ModelResourceLocation itemModel) {
|
||||
queuedBlockModels.put(subTileName, model);
|
||||
queuedItemModels.put(subTileName, itemModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register your model for the given subtile class here.
|
||||
* Call this DURING PREINIT. Calling it anytime after blockModels have already baked does not guarantee that your model will work.
|
||||
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
|
||||
* Tint is applied whenever a player recolors the flower using floral dye
|
||||
* todo 1.8.8 move this elsewhere or otherwise make it fit better with the rest of the subtile registration process
|
||||
*
|
||||
* @param subTileName The String ID of the subtile
|
||||
* @param model A path to a blockstate json and variant to be used the block. The item model will be drawn from the same blockstate json, from variant "inventory"
|
||||
*/
|
||||
public static void register(String subTileName, ModelResourceLocation model) {
|
||||
register(subTileName, model, new ModelResourceLocation(model.getResourceDomain() + ":" + model.getResourcePath(), "inventory"));
|
||||
}
|
||||
|
||||
public static void register(Class<? extends SubTileEntity> clazz, ModelResourceLocation model) {
|
||||
register(BotaniaAPI.getSubTileStringMapping(clazz), model);
|
||||
}
|
||||
|
||||
public static void register(Class<? extends SubTileEntity> clazz, ModelResourceLocation model, ModelResourceLocation itemModel) {
|
||||
register(BotaniaAPI.getSubTileStringMapping(clazz), model, itemModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal implementation
|
||||
**/
|
||||
// SpecialFlowerModel for when there are no blockModels registered for a subtile
|
||||
public static final SpecialFlowerModel INSTANCE = new SpecialFlowerModel(ImmutableMap.<Optional<String>, ModelResourceLocation>of(), ImmutableMap.<Optional<String>, ModelResourceLocation>of());
|
||||
// Models registered from the externel API thus far
|
||||
private static final Map<String, ModelResourceLocation> queuedBlockModels = Maps.newHashMap();
|
||||
private static final Map<String, ModelResourceLocation> queuedItemModels = Maps.newHashMap();
|
||||
|
||||
|
||||
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
|
||||
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
|
||||
|
||||
public SpecialFlowerModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
|
||||
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels) {
|
||||
this.blockModels = blockModels;
|
||||
this.itemModels = itemModels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getDependencies() {
|
||||
ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();
|
||||
builder.addAll(blockModels.values());
|
||||
builder.addAll(itemModels.values());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getTextures() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
||||
// "Bake" the SpecialFlowerModel (in reality, just create another wrapper for all the delegate blockModels)
|
||||
return new SpecialFlowerBakedModel(blockModels, itemModels, format, IPerspectiveAwareModel.MapWrapper.getTransforms(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelState getDefaultState() {
|
||||
return TRSRTransformation.identity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModel process(ImmutableMap<String, String> customData) {
|
||||
// Load the base variant from blockstate json, and also add all the model paths we received from external API
|
||||
ImmutableMap.Builder<Optional<String>, ModelResourceLocation> blockBuilder = ImmutableMap.builder();
|
||||
ImmutableMap.Builder<Optional<String>, ModelResourceLocation> itemBuilder = ImmutableMap.builder();
|
||||
|
||||
for (String key : customData.keySet()) {
|
||||
if ("base".equals(key)) {
|
||||
blockBuilder.put(Optional.<String>absent(), getLocation(customData.get(key)));
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<String, ModelResourceLocation> e : queuedBlockModels.entrySet()) {
|
||||
blockBuilder.put(Optional.of(e.getKey()), e.getValue());
|
||||
}
|
||||
for (Map.Entry<String, ModelResourceLocation> e : queuedItemModels.entrySet()) {
|
||||
itemBuilder.put(Optional.of(e.getKey()), e.getValue());
|
||||
}
|
||||
|
||||
ImmutableMap<Optional<String>, ModelResourceLocation> blockModels = blockBuilder.build();
|
||||
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels = itemBuilder.build();
|
||||
if (blockModels.isEmpty() && itemModels.isEmpty()) return INSTANCE;
|
||||
return new SpecialFlowerModel(blockModels, itemModels);
|
||||
}
|
||||
|
||||
private ModelResourceLocation getLocation(String json) {
|
||||
JsonElement e = new JsonParser().parse(json);
|
||||
if (e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) {
|
||||
return new ModelResourceLocation(e.getAsString());
|
||||
}
|
||||
FMLLog.severe("Expect ModelResourceLocation, got: ", json);
|
||||
return new ModelResourceLocation("builtin/missing", "missing");
|
||||
}
|
||||
|
||||
public enum Loader implements ICustomModelLoader {
|
||||
INSTANCE {
|
||||
@Override
|
||||
public void onResourceManagerReload(IResourceManager resourceManager) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accepts(ResourceLocation modelLocation) {
|
||||
return modelLocation.getResourceDomain().equals("botania_special") && (
|
||||
modelLocation.getResourcePath().equals("specialFlower") ||
|
||||
modelLocation.getResourcePath().equals("models/block/specialFlower") ||
|
||||
modelLocation.getResourcePath().equals("models/item/specialFlower"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModel loadModel(ResourceLocation modelLocation) throws IOException {
|
||||
// Load a dummy model for now, all actual blockModels added in process().
|
||||
return SpecialFlowerModel.INSTANCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class SpecialFlowerBakedModel implements IPerspectiveAwareModel, ISmartBlockModel, ISmartItemModel {
|
||||
|
||||
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
|
||||
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
|
||||
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
|
||||
private final VertexFormat vertexFormat;
|
||||
|
||||
private IBakedModel baseModel;
|
||||
private ImmutableMap<String, IBakedModel> bakedBlockModels;
|
||||
private ImmutableMap<String, IBakedModel> bakedItemModels;
|
||||
private ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>> quads;
|
||||
|
||||
public SpecialFlowerBakedModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
|
||||
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels,
|
||||
VertexFormat format, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> cameraTransforms) {
|
||||
this.blockModels = blockModels;
|
||||
this.itemModels = itemModels;
|
||||
this.vertexFormat = format;
|
||||
this.transforms = cameraTransforms;
|
||||
}
|
||||
|
||||
private void refreshBakedModels() {
|
||||
if (baseModel == null) {
|
||||
ModelManager manager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager();
|
||||
baseModel = getBlockModel(manager, Optional.<String>absent());
|
||||
|
||||
ImmutableMap.Builder<String, IBakedModel> builder = ImmutableMap.builder();
|
||||
for (Map.Entry<Optional<String>, ModelResourceLocation> e : blockModels.entrySet()) {
|
||||
if (e.getKey().isPresent()) {
|
||||
builder.put(e.getKey().get(), getBlockModel(manager, e.getKey()));
|
||||
}
|
||||
}
|
||||
|
||||
bakedBlockModels = builder.build();
|
||||
|
||||
ImmutableMap.Builder<String, IBakedModel> builder2 = ImmutableMap.builder();
|
||||
for (Map.Entry<Optional<String>, ModelResourceLocation> e : itemModels.entrySet()) {
|
||||
if (e.getKey().isPresent()) {
|
||||
builder2.put(e.getKey().get(), getItemModel(manager, e.getKey()));
|
||||
}
|
||||
}
|
||||
|
||||
bakedItemModels = builder2.build();
|
||||
|
||||
ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
|
||||
quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(Optional.<EnumFacing>absent()));
|
||||
for (EnumFacing side : EnumFacing.values()) {
|
||||
quadBuilder.put(Optional.of(side), buildQuads(Optional.of(side)));
|
||||
}
|
||||
quads = quadBuilder.build();
|
||||
}
|
||||
}
|
||||
|
||||
private IBakedModel getBlockModel(ModelManager manager, Optional<String> opt) {
|
||||
ModelResourceLocation loc = blockModels.get(opt);
|
||||
if (loc == null) {
|
||||
loc = new ModelResourceLocation("builtin/missing", "missing");
|
||||
}
|
||||
return manager.getModel(loc);
|
||||
}
|
||||
|
||||
private IBakedModel getItemModel(ModelManager manager, Optional<String> opt) {
|
||||
ModelResourceLocation loc = itemModels.get(opt);
|
||||
if (loc == null) {
|
||||
loc = new ModelResourceLocation("builtin/missing", "missing");
|
||||
}
|
||||
return manager.getModel(loc);
|
||||
}
|
||||
|
||||
private ImmutableList<BakedQuad> buildQuads(Optional<EnumFacing> side) {
|
||||
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
|
||||
for (IBakedModel model : bakedBlockModels.values()) {
|
||||
if (side.isPresent()) {
|
||||
builder.addAll(model.getFaceQuads(side.get()));
|
||||
} else {
|
||||
builder.addAll(model.getGeneralQuads());
|
||||
}
|
||||
}
|
||||
|
||||
for (IBakedModel model : bakedItemModels.values()) {
|
||||
if (side.isPresent()) {
|
||||
builder.addAll(model.getFaceQuads(side.get()));
|
||||
} else {
|
||||
builder.addAll(model.getGeneralQuads());
|
||||
}
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getFaceQuads(EnumFacing side) {
|
||||
refreshBakedModels();
|
||||
return quads.get(Optional.of(side));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getGeneralQuads() {
|
||||
refreshBakedModels();
|
||||
return quads.get(Optional.<EnumFacing>absent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() {
|
||||
refreshBakedModels();
|
||||
return baseModel.isAmbientOcclusion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
refreshBakedModels();
|
||||
return baseModel.isGui3d();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() {
|
||||
refreshBakedModels();
|
||||
return baseModel.isBuiltInRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
refreshBakedModels();
|
||||
return baseModel.getParticleTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return ItemCameraTransforms.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel handleBlockState(IBlockState state) {
|
||||
refreshBakedModels();
|
||||
IExtendedBlockState extendedState = ((IExtendedBlockState) state);
|
||||
IBakedModel ret = bakedBlockModels.get(extendedState.getValue(BotaniaStateProps.SUBTILE_ID));
|
||||
if (ret == null) {
|
||||
System.out.println("Warning: no flower model for subtile: " + extendedState.getValue(BotaniaStateProps.SUBTILE_ID));
|
||||
}
|
||||
return ret == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexFormat getFormat() {
|
||||
return vertexFormat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel handleItemState(ItemStack stack) {
|
||||
refreshBakedModels();
|
||||
//System.out.println("calling smart item");
|
||||
IBakedModel item = bakedItemModels.get(ItemBlockSpecialFlower.getType(stack));
|
||||
if (item == null) {
|
||||
System.out.println("Missing item model, selecting block model");
|
||||
item = bakedBlockModels.get(ItemBlockSpecialFlower.getType(stack));
|
||||
}
|
||||
|
||||
return item == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package vazkii.botania.api.state;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import net.minecraft.block.BlockRailBase;
|
||||
import net.minecraft.block.BlockRailPowered;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
@@ -17,16 +19,20 @@ import javax.annotation.Nullable;
|
||||
*/
|
||||
public class BotaniaStateProps {
|
||||
|
||||
/** The property for specialFlower **/
|
||||
|
||||
public static final PropertyString SUBTILE_ID = new PropertyString("subtile_id");
|
||||
|
||||
/** Common properties to all blocks to use **/
|
||||
|
||||
// The 16 Minecraft colors
|
||||
public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class);
|
||||
public static final PropertyEnum<EnumDyeColor> COLOR = PropertyEnum.create("color", EnumDyeColor.class);
|
||||
|
||||
// The four cardinal directions
|
||||
public static final PropertyEnum CARDINALS = PropertyEnum.create("facing", EnumFacing.class, EnumFacing.Plane.HORIZONTAL);
|
||||
public static final PropertyEnum<EnumFacing> CARDINALS = PropertyEnum.create("facing", EnumFacing.class, EnumFacing.Plane.HORIZONTAL);
|
||||
|
||||
// All 6 directions
|
||||
public static final PropertyEnum FACING = PropertyEnum.create("facing", EnumFacing.class);
|
||||
public static final PropertyEnum<EnumFacing> FACING = PropertyEnum.create("facing", EnumFacing.class);
|
||||
|
||||
// Redstone power - boolean
|
||||
// Also for any other simple boolean "on/off" state
|
||||
@@ -38,18 +44,18 @@ public class BotaniaStateProps {
|
||||
/** Properties for certain kinds of blocks **/
|
||||
|
||||
// The axis directions (think quartz pillars and wood logs)
|
||||
public static final PropertyEnum AXIS_FACING = BlockRotatedPillar.AXIS;
|
||||
public static final PropertyEnum<EnumFacing.Axis> AXIS_FACING = BlockRotatedPillar.AXIS;
|
||||
|
||||
// Extra Quartz Blocks
|
||||
public static final PropertyEnum QUARTZ_VARIANT = PropertyEnum.create("variant", QuartzVariant.class);
|
||||
public static final PropertyEnum<QuartzVariant> QUARTZ_VARIANT = PropertyEnum.create("variant", QuartzVariant.class);
|
||||
|
||||
/** Properties for individual blocks **/
|
||||
|
||||
// Block18Stone
|
||||
public static final PropertyEnum FUTURESTONE_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class);
|
||||
public static final PropertyEnum<FutureStoneVariant> FUTURESTONE_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class);
|
||||
|
||||
// Block18StoneWall
|
||||
public static final PropertyEnum FUTURESTONEWALL_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class, new Predicate<FutureStoneVariant>() {
|
||||
public static final PropertyEnum<FutureStoneVariant> FUTURESTONEWALL_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class, new Predicate<FutureStoneVariant>() {
|
||||
@Override
|
||||
public boolean apply(FutureStoneVariant variant) {
|
||||
// Just the four kinds (no polished, chiseled, etc.)
|
||||
@@ -58,40 +64,51 @@ public class BotaniaStateProps {
|
||||
});
|
||||
|
||||
// BlockAlfPortal
|
||||
public static final PropertyEnum ALFPORTAL_STATE = PropertyEnum.create("state", AlfPortalState.class);
|
||||
public static final PropertyEnum<AlfPortalState> ALFPORTAL_STATE = PropertyEnum.create("state", AlfPortalState.class);
|
||||
|
||||
// BlockAltGrass
|
||||
public static final PropertyEnum ALTGRASS_VARIANT = PropertyEnum.create("variant", AltGrassVariant.class);
|
||||
public static final PropertyEnum<AltGrassVariant> ALTGRASS_VARIANT = PropertyEnum.create("variant", AltGrassVariant.class);
|
||||
|
||||
// BlockBiomeStoneA
|
||||
public static final PropertyEnum BIOMESTONE_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class);
|
||||
public static final PropertyEnum<BiomeStoneVariant> BIOMESTONE_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class);
|
||||
|
||||
// BlockBiomeStoneB
|
||||
public static final PropertyEnum BIOMEBRICK_VARIANT = PropertyEnum.create("variant", BiomeBrickVariant.class);
|
||||
public static final PropertyEnum<BiomeBrickVariant> BIOMEBRICK_VARIANT = PropertyEnum.create("variant", BiomeBrickVariant.class);
|
||||
|
||||
// BlockBiomeStoneWall
|
||||
public static final PropertyEnum<BiomeStoneVariant> BIOMESTONEWALL_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class, new Predicate<BiomeStoneVariant>() {
|
||||
@Override
|
||||
public boolean apply(BiomeStoneVariant input) {
|
||||
return input.getName().contains("cobble");
|
||||
}
|
||||
});
|
||||
|
||||
// BlockCustomBrick
|
||||
public static final PropertyEnum CUSTOMBRICK_VARIANT = PropertyEnum.create("variant", CustomBrickVariant.class);
|
||||
public static final PropertyEnum<CustomBrickVariant> CUSTOMBRICK_VARIANT = PropertyEnum.create("variant", CustomBrickVariant.class);
|
||||
|
||||
// BlockDreamWood, BlockLivingWood
|
||||
public static final PropertyEnum LIVINGWOOD_VARIANT = PropertyEnum.create("variant", LivingWoodVariant.class);
|
||||
public static final PropertyEnum<LivingWoodVariant> LIVINGWOOD_VARIANT = PropertyEnum.create("variant", LivingWoodVariant.class);
|
||||
|
||||
// BlockEnchanter
|
||||
public static final PropertyEnum ENCHANTER_DIRECTION = PropertyEnum.create("facing", EnumFacing.Axis.class, Predicates.not(Predicates.equalTo(EnumFacing.Axis.Y)));
|
||||
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 ENDBRICK_VARIANT = PropertyEnum.create("variant", EndBrickVariant.class);
|
||||
public static final PropertyEnum<EndBrickVariant> ENDBRICK_VARIANT = PropertyEnum.create("variant", EndBrickVariant.class);
|
||||
|
||||
// BlockForestDrum
|
||||
public static final PropertyEnum DRUM_VARIANT = PropertyEnum.create("variant", DrumVariant.class);
|
||||
public static final PropertyEnum<DrumVariant> DRUM_VARIANT = PropertyEnum.create("variant", DrumVariant.class);
|
||||
|
||||
// BlockGhostRail
|
||||
public static final PropertyEnum<BlockRailBase.EnumRailDirection> RAIL_DIRECTION = BlockRailPowered.SHAPE;
|
||||
|
||||
// BlockLightRelay
|
||||
public static final PropertyEnum LUMINIZER_VARIANT = PropertyEnum.create("variant", LuminizerVariant.class);
|
||||
public static final PropertyEnum<LuminizerVariant> LUMINIZER_VARIANT = PropertyEnum.create("variant", LuminizerVariant.class);
|
||||
|
||||
// BlockLivingRock
|
||||
public static final PropertyEnum LIVINGROCK_VARIANT = PropertyEnum.create("variant", LivingRockVariant.class);
|
||||
public static final PropertyEnum<LivingRockVariant> LIVINGROCK_VARIANT = PropertyEnum.create("variant", LivingRockVariant.class);
|
||||
|
||||
// BlockModDoubleFlower
|
||||
public static final PropertyEnum DOUBLEFLOWER_VARIANT_1 = PropertyEnum.create("variant", EnumDyeColor.class, new Predicate<EnumDyeColor>() {
|
||||
public static final PropertyEnum<EnumDyeColor> DOUBLEFLOWER_VARIANT_1 = PropertyEnum.create("variant", EnumDyeColor.class, new Predicate<EnumDyeColor>() {
|
||||
@Override
|
||||
public boolean apply(EnumDyeColor input) {
|
||||
// White to gray
|
||||
@@ -99,7 +116,7 @@ public class BotaniaStateProps {
|
||||
}
|
||||
});
|
||||
|
||||
public static final PropertyEnum DOUBLEFLOWER_VARIANT_2 = PropertyEnum.create("variant", EnumDyeColor.class, new Predicate<EnumDyeColor>() {
|
||||
public static final PropertyEnum<EnumDyeColor> DOUBLEFLOWER_VARIANT_2 = PropertyEnum.create("variant", EnumDyeColor.class, new Predicate<EnumDyeColor>() {
|
||||
@Override
|
||||
public boolean apply(EnumDyeColor input) {
|
||||
// Silver to black
|
||||
@@ -108,10 +125,10 @@ public class BotaniaStateProps {
|
||||
});
|
||||
|
||||
// BlockOpenCrate
|
||||
public static final PropertyEnum CRATE_VARIANT = PropertyEnum.create("variant", CrateVariant.class);
|
||||
public static final PropertyEnum<CrateVariant> CRATE_VARIANT = PropertyEnum.create("variant", CrateVariant.class);
|
||||
|
||||
// BlockPavement
|
||||
public static final PropertyEnum PAVEMENT_COLOR = PropertyEnum.create("color", EnumDyeColor.class, new Predicate<EnumDyeColor>() {
|
||||
public static final PropertyEnum<EnumDyeColor> PAVEMENT_COLOR = PropertyEnum.create("color", EnumDyeColor.class, new Predicate<EnumDyeColor>() {
|
||||
@Override
|
||||
public boolean apply(EnumDyeColor color) {
|
||||
return color == EnumDyeColor.WHITE || color == EnumDyeColor.BLACK
|
||||
@@ -121,25 +138,25 @@ public class BotaniaStateProps {
|
||||
});
|
||||
|
||||
// BlockPlatform
|
||||
public static final PropertyEnum PLATFORM_VARIANT = PropertyEnum.create("variant", PlatformVariant.class);
|
||||
public static final PropertyEnum<PlatformVariant> PLATFORM_VARIANT = PropertyEnum.create("variant", PlatformVariant.class);
|
||||
|
||||
// BlockPool
|
||||
public static final PropertyEnum POOL_VARIANT = PropertyEnum.create("variant", PoolVariant.class);
|
||||
public static final PropertyEnum<PoolVariant> POOL_VARIANT = PropertyEnum.create("variant", PoolVariant.class);
|
||||
|
||||
// BlockPrism
|
||||
public static final PropertyBool HAS_LENS = PropertyBool.create("has_lens");
|
||||
|
||||
// BlockPrismarine
|
||||
public static final PropertyEnum PRISMARINE_VARIANT = PropertyEnum.create("variant", PrismarineVariant.class);
|
||||
public static final PropertyEnum<PrismarineVariant> PRISMARINE_VARIANT = PropertyEnum.create("variant", PrismarineVariant.class);
|
||||
|
||||
// BlockPylon
|
||||
public static final PropertyEnum PYLON_VARIANT = PropertyEnum.create("variant", PylonVariant.class);
|
||||
public static final PropertyEnum<PylonVariant> PYLON_VARIANT = PropertyEnum.create("variant", PylonVariant.class);
|
||||
|
||||
// BlockSpreader
|
||||
public static final PropertyEnum SPREADER_VARIANT = PropertyEnum.create("variant", SpreaderVariant.class);
|
||||
public static final PropertyEnum<SpreaderVariant> SPREADER_VARIANT = PropertyEnum.create("variant", SpreaderVariant.class);
|
||||
|
||||
// BlockStorage
|
||||
public static final PropertyEnum STORAGE_VARIANT = PropertyEnum.create("variant", StorageVariant.class);
|
||||
public static final PropertyEnum<StorageVariant> STORAGE_VARIANT = PropertyEnum.create("variant", StorageVariant.class);
|
||||
|
||||
private BotaniaStateProps() {}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package vazkii.botania.api.state;
|
||||
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
|
||||
public class PropertyString implements IUnlistedProperty<String> {
|
||||
|
||||
private final String name;
|
||||
|
||||
public PropertyString(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<String> getType() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString(String value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,87 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoublePlant;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.BlockRailPowered;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
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.GameData;
|
||||
import vazkii.botania.api.render.SpecialFlowerModel;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.AltGrassVariant;
|
||||
import vazkii.botania.api.state.enums.BiomeBrickVariant;
|
||||
import vazkii.botania.api.state.enums.BiomeStoneVariant;
|
||||
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.PylonVariant;
|
||||
import vazkii.botania.api.state.enums.StorageVariant;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.ModFluffBlocks;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockModSlab;
|
||||
import vazkii.botania.common.item.ItemGaiaHead;
|
||||
import vazkii.botania.common.block.subtile.SubTileDecor;
|
||||
import vazkii.botania.common.block.subtile.SubTileManastar;
|
||||
import vazkii.botania.common.block.subtile.SubTilePureDaisy;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileAgricarnation;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileBellethorn;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileBubbell;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileClayconia;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileDaffomill;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileDreadthorn;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileExoflame;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileFallenKanade;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileHeiseiDream;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileHopperhock;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileHyacidus;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileJadedAmaranthus;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileJiyuulia;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileLoonuim;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileMarimorphosis;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileMedumone;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileOrechid;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileOrechidIgnem;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTilePollidisiac;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileRannuncarpus;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileSolegnolia;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileSpectranthemum;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileTangleberrie;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileTigerseye;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileVinculotus;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileArcaneRose;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileDandelifeon;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileDaybloom;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileEndoflame;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileEntropinnyum;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileGourmaryllis;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileHydroangeas;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileKekimurus;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileMunchdew;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus;
|
||||
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.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import static vazkii.botania.common.item.ModItems.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -35,23 +91,25 @@ public final class ModelHandler {
|
||||
// In addition, many of the jsons currently use the vanilla format (simple and verified bug-free).
|
||||
// Once things settle down, we'll move to forge jsons, which will drastically cut down on the number of json files
|
||||
public static void registerModels() {
|
||||
ModelLoaderRegistry.registerLoader(SpecialFlowerModel.Loader.INSTANCE);
|
||||
OBJLoader.instance.addDomain(LibMisc.MOD_ID.toLowerCase(Locale.ROOT));
|
||||
|
||||
/** Subtile block models **/
|
||||
registerSubtiles();
|
||||
|
||||
/** Custom statemappers **/
|
||||
registerStateMappers();
|
||||
|
||||
/** ItemBlocks **/
|
||||
registerStandardBlocks();
|
||||
registerStorage();
|
||||
registerMushrooms();
|
||||
registerFlowers();
|
||||
registerLivingRockWood();
|
||||
registerAltGrass();
|
||||
registerPavement();
|
||||
registerStairs();
|
||||
registerSlabs();
|
||||
registerFullSlabs();
|
||||
registerWalls();
|
||||
registerPanes();
|
||||
registerPylons();
|
||||
registerUnstableBeaconPetal();
|
||||
|
||||
/** Normal Items **/
|
||||
registerStandardItems();
|
||||
@@ -62,15 +120,103 @@ public final class ModelHandler {
|
||||
registerItemModelMetas(craftPattern, LibItemNames.CRAFT_PATTERN, 9);
|
||||
/** Special Item Meshers **/
|
||||
}
|
||||
private static void registerStandardBlocks() {
|
||||
registerItemModel(ModBlocks.manaGlass);
|
||||
registerItemModel(ModBlocks.elfGlass);
|
||||
|
||||
private static void registerSubtiles() {
|
||||
SpecialFlowerModel.register(SubTileManastar.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_MANASTAR));
|
||||
SpecialFlowerModel.register(SubTilePureDaisy.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_PUREDAISY));
|
||||
|
||||
SpecialFlowerModel.register(SubTileDaybloom.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_DAYBLOOM));
|
||||
SpecialFlowerModel.register(SubTileDecor.Daybloom.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_DAYBLOOM + "Decor"));
|
||||
SpecialFlowerModel.register(SubTileDaybloom.Prime.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_DAYBLOOM_PRIME));
|
||||
SpecialFlowerModel.register(SubTileEndoflame.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_ENDOFLAME));
|
||||
SpecialFlowerModel.register(SubTileHydroangeas.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_HYDROANGEAS));
|
||||
SpecialFlowerModel.register(SubTileDecor.Hydroangeas.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_HYDROANGEAS + "Decor"));
|
||||
SpecialFlowerModel.register(SubTileThermalily.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_THERMALILY));
|
||||
SpecialFlowerModel.register(SubTileNightshade.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_NIGHTSHADE));
|
||||
SpecialFlowerModel.register(SubTileDecor.Nightshade.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_NIGHTSHADE + "Decor"));
|
||||
SpecialFlowerModel.register(SubTileNightshade.Prime.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_NIGHTSHADE_PRIME));
|
||||
SpecialFlowerModel.register(SubTileArcaneRose.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_ARCANE_ROSE));
|
||||
SpecialFlowerModel.register(SubTileMunchdew.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_MUNCHDEW));
|
||||
SpecialFlowerModel.register(SubTileEntropinnyum.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_ENTROPINNYUM));
|
||||
SpecialFlowerModel.register(SubTileKekimurus.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_KEKIMURUS));
|
||||
SpecialFlowerModel.register(SubTileGourmaryllis.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_GOURMARYLLIS));
|
||||
SpecialFlowerModel.register(SubTileNarslimmus.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_NARSLIMMUS));
|
||||
SpecialFlowerModel.register(SubTileSpectrolus.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_SPECTROLUS));
|
||||
SpecialFlowerModel.register(SubTileDandelifeon.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_DANDELIFEON));
|
||||
SpecialFlowerModel.register(SubTileRafflowsia.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_RAFFLOWSIA));
|
||||
|
||||
SpecialFlowerModel.register(SubTileBellethorn.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BELLETHORN));
|
||||
SpecialFlowerModel.register(SubTileBellethorn.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BELLETHORN + "Chibi"));
|
||||
SpecialFlowerModel.register(SubTileDreadthorn.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_DREADTHORN));
|
||||
SpecialFlowerModel.register(SubTileHeiseiDream.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_HEISEI_DREAM));
|
||||
SpecialFlowerModel.register(SubTileTigerseye.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_TIGERSEYE));
|
||||
SpecialFlowerModel.register(SubTileJadedAmaranthus.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_JADED_AMARANTHUS));
|
||||
SpecialFlowerModel.register(SubTileOrechid.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_ORECHID));
|
||||
SpecialFlowerModel.register(SubTileOrechidIgnem.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_ORECHID_IGNEM));
|
||||
SpecialFlowerModel.register(SubTileFallenKanade.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_FALLEN_KANADE));
|
||||
SpecialFlowerModel.register(SubTileExoflame.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_EXOFLAME));
|
||||
SpecialFlowerModel.register(SubTileAgricarnation.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_AGRICARNATION));
|
||||
SpecialFlowerModel.register(SubTileAgricarnation.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_AGRICARNATION + "Chibi"));
|
||||
SpecialFlowerModel.register(SubTileHopperhock.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_HOPPERHOCK));
|
||||
SpecialFlowerModel.register(SubTileHopperhock.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_HOPPERHOCK + "Chibi"));
|
||||
SpecialFlowerModel.register(SubTileTangleberrie.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_TANGLEBERRIE));
|
||||
SpecialFlowerModel.register(SubTileJiyuulia.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_JIYUULIA));
|
||||
SpecialFlowerModel.register(SubTileRannuncarpus.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_RANNUNCARPUS));
|
||||
SpecialFlowerModel.register(SubTileRannuncarpus.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_RANNUNCARPUS + "Chibi"));
|
||||
SpecialFlowerModel.register(SubTileHyacidus.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_HYACIDUS));
|
||||
SpecialFlowerModel.register(SubTilePollidisiac.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_POLLIDISIAC));
|
||||
SpecialFlowerModel.register(SubTileClayconia.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_CLAYCONIA));
|
||||
SpecialFlowerModel.register(SubTileLoonuim.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_LOONIUM));
|
||||
SpecialFlowerModel.register(SubTileDaffomill.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_DAFFOMILL));
|
||||
SpecialFlowerModel.register(SubTileVinculotus.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_VINCULOTUS));
|
||||
SpecialFlowerModel.register(SubTileSpectranthemum.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_SPECTRANTHEMUM));
|
||||
SpecialFlowerModel.register(SubTileMedumone.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_MEDUMONE));
|
||||
SpecialFlowerModel.register(SubTileMarimorphosis.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_MARIMORPHOSIS));
|
||||
SpecialFlowerModel.register(SubTileMarimorphosis.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_MARIMORPHOSIS + "Chibi"));
|
||||
SpecialFlowerModel.register(SubTileBubbell.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BUBBELL));
|
||||
SpecialFlowerModel.register(SubTileBubbell.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BUBBELL + "Chibi"));
|
||||
SpecialFlowerModel.register(SubTileSolegnolia.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_SOLEGNOLIA));
|
||||
SpecialFlowerModel.register(SubTileSolegnolia.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_SOLEGNOLIA + "Chibi"));
|
||||
}
|
||||
|
||||
private static void registerStandardBlocks() {
|
||||
registerItemModel(ModBlocks.manaGlass);
|
||||
registerItemModel(ModBlocks.elfGlass);
|
||||
registerItemModel(ModBlocks.runeAltar);
|
||||
registerItemModel(ModBlocks.pistonRelay);
|
||||
registerItemModel(ModBlocks.distributor);
|
||||
registerItemModel(ModBlocks.starfield);
|
||||
registerItemModel(ModBlocks.specialFlower);
|
||||
registerItemModel(ModBlocks.dirtPath);
|
||||
registerItemModel(ModBlocks.felPumpkin);
|
||||
registerItemModel(ModBlocks.ghostRail);
|
||||
registerItemModel(ModBlocks.shimmerrock);
|
||||
registerItemModel(ModBlocks.shimmerwoodPlanks);
|
||||
registerItemModel(ModBlocks.manaVoid);
|
||||
registerItemModel(ModBlocks.alchemyCatalyst);
|
||||
registerItemModel(ModBlocks.conjurationCatalyst);
|
||||
registerItemModel(ModBlocks.reedBlock);
|
||||
|
||||
// Blocks which share models with their item, and have only one variant to switch over
|
||||
registerVariantsDefaulted(ModBlocks.altGrass, AltGrassVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.storage, StorageVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.pylon, PylonVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.forestDrum, DrumVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.livingrock, LivingRockVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.livingwood, LivingWoodVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.dreamwood, LivingWoodVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModFluffBlocks.stone, FutureStoneVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModFluffBlocks.biomeStoneA, BiomeStoneVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModFluffBlocks.biomeStoneB, BiomeBrickVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.endStoneBrick, EndBrickVariant.class, "variant");
|
||||
}
|
||||
|
||||
private static void registerStandardItems() {
|
||||
registerItemModel(pestleAndMortar);
|
||||
registerItemModel(blackLotus);
|
||||
registerItemModel(blackLotus, 1);
|
||||
registerItemModel(lexicon);
|
||||
registerItemModel(manaCookie);
|
||||
|
||||
registerItemModel(manasteelHelm);
|
||||
registerItemModel(manasteelChest);
|
||||
@@ -108,22 +254,46 @@ public final class ModelHandler {
|
||||
registerItemModel(starSword);
|
||||
registerItemModel(thunderSword);
|
||||
registerItemModel(glassPick);
|
||||
registerItemModel(twigWand);
|
||||
|
||||
registerItemModel(dirtRod);
|
||||
registerItemModel(cobbleRod);
|
||||
registerItemModel(fireRod);
|
||||
registerItemModel(rainbowRod);
|
||||
registerItemModel(skyDirtRod);
|
||||
registerItemModel(tornadoRod);
|
||||
registerItemModel(terraformRod);
|
||||
}
|
||||
|
||||
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.addVariantName(item, name);
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerStateMappers() {
|
||||
// Ignore vanilla facing, variant in double flower
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.doubleFlower1, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.field_181084_N).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.doubleFlower2, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.field_181084_N).build());
|
||||
|
||||
// Ignore redstone power state in some blocks
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.starfield, (new StateMap.Builder()).ignore(BotaniaStateProps.POWERED).build());
|
||||
|
||||
// Ignore color in unstable cube, mana beacon, and petals (handled by color multiplier)
|
||||
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());
|
||||
|
||||
// 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());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.specialFlower, (new StateMap.Builder()).ignore(((BlockFlower) ModBlocks.specialFlower).getTypeProperty()).build());
|
||||
|
||||
// Ignore in special flower to suppress errors (handled in custom statemapper in BlockSpecialFlower
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.specialFlower, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR, ((BlockFlower) ModBlocks.specialFlower).getTypeProperty()).build());
|
||||
|
||||
// Ignore vanilla variant in walls
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.biomeStoneWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
@@ -148,11 +318,12 @@ public final class ModelHandler {
|
||||
}
|
||||
|
||||
List<Block> otherSlabs = ImmutableList.copyOf(new Block[] {
|
||||
ModFluffBlocks.livingwoodSlab, ModFluffBlocks.livingrockSlab, ModFluffBlocks.dreamwoodSlab, ModFluffBlocks.livingrockBrickSlab,
|
||||
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.darkQuartzSlab, ModFluffBlocks.manaQuartzSlab, ModFluffBlocks.blazeQuartzSlab,
|
||||
ModFluffBlocks.lavenderQuartzSlab, ModFluffBlocks.redQuartzSlab, ModFluffBlocks.elfQuartzSlab, ModFluffBlocks.sunnyQuartzSlab
|
||||
ModFluffBlocks.lavenderQuartzSlab, ModFluffBlocks.redQuartzSlab, ModFluffBlocks.elfQuartzSlab, ModFluffBlocks.sunnyQuartzSlab, ModFluffBlocks.dirtPathSlab,
|
||||
ModFluffBlocks.shimmerrockSlab, ModFluffBlocks.shimmerwoodPlankSlab, ModFluffBlocks.endStoneSlab, ModFluffBlocks.enderBrickSlab
|
||||
});
|
||||
|
||||
for (Block b : otherSlabs) {
|
||||
@@ -171,13 +342,14 @@ public final class ModelHandler {
|
||||
for (Block b : ModFluffBlocks.stoneFullSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
|
||||
}
|
||||
|
||||
|
||||
List<Block> otherFullSlabs = ImmutableList.copyOf(new Block[] {
|
||||
ModFluffBlocks.livingwoodSlabFull, ModFluffBlocks.livingrockSlabFull, ModFluffBlocks.dreamwoodSlabFull, ModFluffBlocks.livingrockBrickSlabFull,
|
||||
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.lavenderQuartzSlabFull, ModFluffBlocks.redQuartzSlabFull, ModFluffBlocks.elfQuartzSlabFull, ModFluffBlocks.sunnyQuartzSlabFull, ModFluffBlocks.dirtPathSlabFull,
|
||||
ModFluffBlocks.shimmerrockSlabFull, ModFluffBlocks.shimmerwoodPlankSlabFull, ModFluffBlocks.endStoneSlabFull, ModFluffBlocks.enderBrickSlabFull
|
||||
});
|
||||
|
||||
for (Block b : otherFullSlabs) {
|
||||
@@ -185,62 +357,86 @@ public final class ModelHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerAltGrass() {
|
||||
Item item = ItemGaiaHead.getItemFromBlock(ModBlocks.altGrass);
|
||||
for (AltGrassVariant variant : AltGrassVariant.values()) {
|
||||
String name = "botania:altGrass_" + variant.getName();
|
||||
ModelLoader.addVariantName(item, name);
|
||||
ModelLoader.setCustomModelResourceLocation(item, variant.ordinal(), new ModelResourceLocation(name, "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerStorage() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.storage);
|
||||
for (StorageVariant variant : StorageVariant.values()) {
|
||||
String name = "botania:storage_" + variant.getName();
|
||||
ModelLoader.addVariantName(item, name);
|
||||
ModelLoader.setCustomModelResourceLocation(item, variant.ordinal(), new ModelResourceLocation(name, "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerMushrooms() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.mushroom);
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
String name = "botania:mushroom_" + color.getName();
|
||||
ModelLoader.addVariantName(item, name);
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory"));
|
||||
String name = GameData.getBlockRegistry().getNameForObject(ModBlocks.mushroom).toString();
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerFlowers() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.flower);
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
String name = "botania:flower_" + color.getName();
|
||||
ModelLoader.addVariantName(item, name);
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory"));
|
||||
String name = GameData.getBlockRegistry().getNameForObject(ModBlocks.flower).toString();
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
}
|
||||
|
||||
item = Item.getItemFromBlock(ModBlocks.shinyFlower);
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
String name = "botania:shinyFlower_" + color.getName();
|
||||
ModelLoader.addVariantName(item, name);
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory"));
|
||||
String name = GameData.getBlockRegistry().getNameForObject(ModBlocks.shinyFlower).toString();
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
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 = GameData.getBlockRegistry().getNameForObject(ModBlocks.doubleFlower1).toString();
|
||||
String variant = "inventory_" + color.getName();
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, variant));
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, variant));
|
||||
}
|
||||
|
||||
item = Item.getItemFromBlock(ModBlocks.doubleFlower2);
|
||||
for (EnumDyeColor color : BotaniaStateProps.DOUBLEFLOWER_VARIANT_2.getAllowedValues()) {
|
||||
String name = GameData.getBlockRegistry().getNameForObject(ModBlocks.doubleFlower2).toString();
|
||||
String variant = "inventory_" + color.getName();
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, variant));
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata() - 8, new ModelResourceLocation(name, variant));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerLivingRockWood() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.livingrock);
|
||||
for (LivingRockVariant variant : LivingRockVariant.values()) {
|
||||
String name = "botania:livingrock_" + variant.getName();
|
||||
ModelLoader.addVariantName(item, name);
|
||||
ModelLoader.setCustomModelResourceLocation(item, variant.ordinal(), new ModelResourceLocation(name, "inventory"));
|
||||
}
|
||||
private static void registerPavement() {
|
||||
Item item = Item.getItemFromBlock(ModFluffBlocks.pavement);
|
||||
String name = GameData.getBlockRegistry().getNameForObject(ModFluffBlocks.pavement).toString();
|
||||
|
||||
item = Item.getItemFromBlock(ModBlocks.livingwood);
|
||||
for (LivingWoodVariant variant : LivingWoodVariant.values()) {
|
||||
String name = "botania:livingwood_" + variant.getName();
|
||||
ModelLoader.addVariantName(item, name);
|
||||
ModelLoader.setCustomModelResourceLocation(item, variant.ordinal(), new ModelResourceLocation(name, "inventory"));
|
||||
for (EnumDyeColor e : BotaniaStateProps.PAVEMENT_COLOR.getAllowedValues()) {
|
||||
String variant = "color=" + e.getName();
|
||||
switch (e) {
|
||||
case BLACK: {
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, variant));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case BLUE: {
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, variant));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 2, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case RED: {
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, variant));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 3, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case YELLOW: {
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, variant));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 4, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case GREEN: {
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, variant));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 5, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case WHITE:
|
||||
default: {
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, variant));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,11 +482,70 @@ public final class ModelHandler {
|
||||
}
|
||||
|
||||
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);
|
||||
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 registerFullSlabs() {
|
||||
private static void registerWalls() {
|
||||
Item item = Item.getItemFromBlock(ModFluffBlocks.biomeStoneWall);
|
||||
for (BiomeStoneVariant variant : BotaniaStateProps.BIOMESTONEWALL_VARIANT.getAllowedValues()) {
|
||||
String variantName = "inventory_" + variant.getName();
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation("botania:biomeStoneA0Wall", variantName));
|
||||
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.registerItemVariants(item, new ModelResourceLocation("botania:stone0Wall", variantName));
|
||||
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() {
|
||||
@@ -299,12 +554,28 @@ public final class ModelHandler {
|
||||
registerItemModel(ModFluffBlocks.managlassPane);
|
||||
}
|
||||
|
||||
private static void registerPylons() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.pylon);
|
||||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation("botania:pylon", "variant=mana"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation("botania:pylon", "variant=natura"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 2, new ModelResourceLocation("botania:pylon", "variant=gaia"));
|
||||
private static void registerUnstableBeaconPetal() {
|
||||
// The blocks that are dynamically colored, not through their states
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
Item unstable = Item.getItemFromBlock(ModBlocks.unstableBlock);
|
||||
Item beacon = Item.getItemFromBlock(ModBlocks.manaBeacon);
|
||||
Item petal = Item.getItemFromBlock(ModBlocks.petalBlock);
|
||||
ModelLoader.setCustomModelResourceLocation(unstable, color.getMetadata(), new ModelResourceLocation("botania:unstableBlock", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(beacon, color.getMetadata(), new ModelResourceLocation("botania:manaBeacon", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(petal, color.getMetadata(), new ModelResourceLocation("botania:petalBlock", "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
private static <T extends Enum<T> & IStringSerializable> void registerVariantsDefaulted(Block b, Class<T> enumclazz, String variantHeader) {
|
||||
Item item = Item.getItemFromBlock(b);
|
||||
for (T e : enumclazz.getEnumConstants()) {
|
||||
String baseName = GameData.getBlockRegistry().getNameForObject(b).toString();
|
||||
String variantName = variantHeader + "=" + e.getName();
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(baseName, variantName));
|
||||
ModelLoader.setCustomModelResourceLocation(item, e.ordinal(), new ModelResourceLocation(baseName, variantName));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerItemModelMetas(Item item, String loc,int range) {
|
||||
for(int i =0; i < range;i++) {
|
||||
String name = "botania:"+loc+i;
|
||||
@@ -312,6 +583,7 @@ public final class ModelHandler {
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name,"inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerItemModel(Block b) {
|
||||
registerItemModel(Item.getItemFromBlock(b));
|
||||
}
|
||||
@@ -326,4 +598,4 @@ public final class ModelHandler {
|
||||
}
|
||||
|
||||
private ModelHandler() {}
|
||||
}
|
||||
}
|
||||
@@ -176,13 +176,11 @@ public final class RenderHelper {
|
||||
int r = (color & 0xFF0000) >> 16;
|
||||
int g = (color & 0xFF00) >> 8;
|
||||
int b = (color & 0xFF);
|
||||
tessellator.getWorldRenderer().putColorMultiplier(r, g, b, (int) (255F * (1F - f2)));
|
||||
tessellator.getWorldRenderer().pos(0, 0, 0).endVertex();
|
||||
tessellator.getWorldRenderer().putColorMultiplier(0F, 0F, 0F, 0);
|
||||
tessellator.getWorldRenderer().pos(-0.866D * f4, f3, -0.5F * f4).endVertex();
|
||||
tessellator.getWorldRenderer().pos(0.866D * f4, f3, -0.5F * f4).endVertex();
|
||||
tessellator.getWorldRenderer().pos(0, f3, 1F * f4).endVertex();
|
||||
tessellator.getWorldRenderer().pos(-0.866D * f4, f3, -0.5F * f4).endVertex();
|
||||
tessellator.getWorldRenderer().pos(0, 0, 0).color(r, g, b, 255F * (1F - f2)).endVertex();
|
||||
tessellator.getWorldRenderer().pos(-0.866D * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex();
|
||||
tessellator.getWorldRenderer().pos(0.866D * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex();
|
||||
tessellator.getWorldRenderer().pos(0, f3, 1F * f4).color(0, 0, 0, 0).endVertex();
|
||||
tessellator.getWorldRenderer().pos(-0.866D * f4, f3, -0.5F * f4).color(0, 0, 0, 0).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSettings.GameType;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import vazkii.botania.api.item.IExtendedPlayerController;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -40,6 +41,7 @@ import vazkii.botania.api.lexicon.multiblock.IMultiblockRenderHook;
|
||||
import vazkii.botania.api.lexicon.multiblock.Multiblock;
|
||||
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
|
||||
import vazkii.botania.api.lexicon.multiblock.component.AnyComponent;
|
||||
import vazkii.botania.api.render.SpecialFlowerModel;
|
||||
import vazkii.botania.api.wiki.IWikiProvider;
|
||||
import vazkii.botania.api.wiki.WikiHooks;
|
||||
import vazkii.botania.client.challenge.ModChallenges;
|
||||
|
||||
@@ -16,8 +16,10 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -59,17 +61,9 @@ public class RenderTileFloatingFlower extends TileEntitySpecialRenderer {
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
ItemStack stack = flower.getDisplayStack();
|
||||
// Minecraft.getMinecraft().getRenderItem().renderItemModel(stack); // todo 1.8
|
||||
// IIcon icon = stack.getIconIndex();
|
||||
//
|
||||
// Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
// float f = icon.getMinU();
|
||||
// float f1 = icon.getMaxU();
|
||||
// float f2 = icon.getMinV();
|
||||
// float f3 = icon.getMaxV();
|
||||
// GlStateManager.translate(0.25F, 0.4F, 0.5F);
|
||||
// GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
// ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F);
|
||||
GlStateManager.translate(0.5F, 0.65F, 0.5F);
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
Minecraft.getMinecraft().getRenderItem().func_181564_a(stack, ItemCameraTransforms.TransformType.NONE);
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
|
||||
time += new Random(tileentity.getPos().hashCode()).nextInt(100000);
|
||||
|
||||
Color color = Color.getHSBColor(time * 0.005F, 0.6F, 1F);
|
||||
GlStateManager.color((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 255);
|
||||
GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 255);
|
||||
} else {
|
||||
int hex = pool.color.getMapColor().colorValue;
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RenderTileStarfield extends TileEntitySpecialRenderer {
|
||||
float f2 = (float)this.rendererDispatcher.entityZ;
|
||||
GlStateManager.disableLighting();
|
||||
field_147527_e.setSeed(31100L);
|
||||
float f3 = 0.75F;
|
||||
float f3 = 0.24F;
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ public class RenderTileStarfield extends TileEntitySpecialRenderer {
|
||||
GlStateManager.matrixMode(5890);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.loadIdentity();
|
||||
GlStateManager.translate(0.0F, (float)(Minecraft.getSystemTime() % 700000L) / 700000.0F, 0.0F);
|
||||
GlStateManager.translate(0.0F, (float)(Minecraft.getSystemTime() % 20000) / 20000.0F, 0.0F);
|
||||
GlStateManager.scale(f5, f5, f5);
|
||||
GlStateManager.translate(0.5F, 0.5F, 0.0F);
|
||||
GlStateManager.rotate((float)(i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
@@ -117,6 +117,13 @@ public class RenderTileStarfield extends TileEntitySpecialRenderer {
|
||||
f11 = f12 = f13 = 1.0F * f6;
|
||||
}
|
||||
|
||||
Color color = Color.getHSBColor(Minecraft.getSystemTime() / 20F % 360 / 360F, 1F, 1F);
|
||||
f11 = color.getRed() / 255F;
|
||||
f12 = color.getGreen() / 255F;
|
||||
f13 = color.getBlue() / 255F;
|
||||
|
||||
f11 *= f6; f12 *= f6; f13 *= f6;
|
||||
|
||||
worldrenderer.pos(x, y + (double)f3, z).color(f11, f12, f13, 1.0F).endVertex();
|
||||
worldrenderer.pos(x, y + (double)f3, z + 1.0D).color(f11, f12, f13, 1.0F).endVertex();
|
||||
worldrenderer.pos(x + 1.0D, y + (double)f3, z + 1.0D).color(f11, f12, f13, 1.0F).endVertex();
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.item.block.ItemBlockMod;
|
||||
@@ -38,7 +39,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockGhostRail extends BlockRailBase implements ILexiconable {
|
||||
|
||||
public static final PropertyEnum<EnumRailDirection> SHAPE = BlockRailPowered.SHAPE;
|
||||
private static final String TAG_FLOAT_TICKS = "Botania_FloatTicks";
|
||||
|
||||
public BlockGhostRail() {
|
||||
@@ -46,22 +46,22 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
setUnlocalizedName(LibBlockNames.GHOST_RAIL);
|
||||
setDefaultState(blockState.getBaseState().withProperty(SHAPE, EnumRailDirection.NORTH_SOUTH));
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.RAIL_DIRECTION, EnumRailDirection.NORTH_SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, SHAPE);
|
||||
return new BlockState(this, BotaniaStateProps.RAIL_DIRECTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(SHAPE).getMetadata();
|
||||
return state.getValue(BotaniaStateProps.RAIL_DIRECTION).getMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(SHAPE, EnumRailDirection.byMetadata(meta));
|
||||
return getDefaultState().withProperty(BotaniaStateProps.RAIL_DIRECTION, EnumRailDirection.byMetadata(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.BlockDoublePlant;
|
||||
@@ -30,6 +32,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
@@ -50,15 +53,13 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// Lots of copy paste from BlockDoublePlant because we can no longer extend it in 1.8.x
|
||||
public abstract class BlockModDoubleFlower extends BlockBush implements IGrowable, IShearable, ILexiconable {
|
||||
public static final PropertyEnum<BlockDoublePlant.EnumBlockHalf> HALF = BlockDoublePlant.HALF;
|
||||
public abstract class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable {
|
||||
private static final int COUNT = 8;
|
||||
|
||||
final int offset;
|
||||
final boolean second;
|
||||
|
||||
public BlockModDoubleFlower(boolean second) {
|
||||
super(Material.vine);
|
||||
this.second = second;
|
||||
this.setHardness(0.0F);
|
||||
this.setStepSound(soundTypeGrass);
|
||||
@@ -93,7 +94,7 @@ public abstract class BlockModDoubleFlower extends BlockBush implements IGrowabl
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,11 +107,6 @@ public abstract class BlockModDoubleFlower extends BlockBush implements IGrowabl
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
|
||||
// todo 1.8.8 drop
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World p_149636_1_, EntityPlayer p_149636_2_, BlockPos pos, IBlockState state, TileEntity te) {
|
||||
if(p_149636_1_.isRemote || p_149636_2_.getCurrentEquippedItem() == null || p_149636_2_.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.LOWER)
|
||||
@@ -185,7 +181,10 @@ public abstract class BlockModDoubleFlower extends BlockBush implements IGrowabl
|
||||
@Override
|
||||
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
ret.add(new ItemStack(this, 1, getMetaFromState(world.getBlockState(pos).withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER))));
|
||||
if (world.getBlockState(pos.down()).getBlock() == this
|
||||
&& world.getBlockState(pos.down()).getValue(HALF) == EnumBlockHalf.LOWER) {
|
||||
ret.add(new ItemStack(this, 1, getMetaFromState(world.getBlockState(pos.down()))));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -205,14 +204,9 @@ public abstract class BlockModDoubleFlower extends BlockBush implements IGrowabl
|
||||
p_149666_3_.add(new ItemStack(p_149666_1_, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idDoubleFlower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World par1World, BlockPos pos, IBlockState state, Random par5Random) {
|
||||
int hex = ((EnumDyeColor) state.getValue(second ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1)).getMapColor().colorValue;
|
||||
int hex = state.getValue(second ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1).getMapColor().colorValue;
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
int g = (hex & 0xFF00) >> 8;
|
||||
int b = (hex & 0xFF);
|
||||
@@ -227,93 +221,18 @@ public abstract class BlockModDoubleFlower extends BlockBush implements IGrowabl
|
||||
return LexiconData.flowers;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** BEGIN COPY BlockDoublePlant **/
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return super.canPlaceBlockAt(worldIn, pos) && worldIn.isAirBlock(pos.up());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkAndDropBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (!this.canBlockStay(worldIn, pos, state))
|
||||
{
|
||||
boolean flag = state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER;
|
||||
BlockPos blockpos = flag ? pos : pos.up();
|
||||
BlockPos blockpos1 = flag ? pos.down() : pos;
|
||||
Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock());
|
||||
Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this);
|
||||
|
||||
if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air.
|
||||
|
||||
if (block == this)
|
||||
{
|
||||
worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2);
|
||||
}
|
||||
|
||||
if (block1 == this)
|
||||
{
|
||||
worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
|
||||
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
|
||||
{
|
||||
return worldIn.getBlockState(pos.down()).getBlock() == this;
|
||||
}
|
||||
else
|
||||
{
|
||||
IBlockState iblockstate = worldIn.getBlockState(pos.up());
|
||||
return iblockstate.getBlock() == this && super.canBlockStay(worldIn, pos, iblockstate);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
worldIn.setBlockState(pos.up(), this.getDefaultState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
|
||||
{
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) {
|
||||
IBlockState iblockstate = worldIn.getBlockState(pos.down());
|
||||
|
||||
if (iblockstate.getBlock() == this)
|
||||
{
|
||||
state = state.withProperty(BotaniaStateProps.COLOR, iblockstate.getValue(BotaniaStateProps.COLOR));
|
||||
if (iblockstate.getBlock() == this) {
|
||||
PropertyEnum<EnumDyeColor> prop = second ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1;
|
||||
state = state.withProperty(prop, iblockstate.getValue(prop));
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
return state.withProperty(VARIANT, EnumPlantType.SUNFLOWER).withProperty(field_181084_N, EnumFacing.SOUTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
||||
{
|
||||
//Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames.
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() == this && state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this)
|
||||
world.setBlockToAir(pos.up());
|
||||
return world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,23 +4,28 @@ import net.minecraft.block.BlockDoublePlant;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
|
||||
// White to Gray
|
||||
public class BlockModDoubleFlower1 extends BlockModDoubleFlower {
|
||||
public BlockModDoubleFlower1() {
|
||||
super(false);
|
||||
setDefaultState(blockState.getBaseState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, EnumDyeColor.WHITE));
|
||||
setDefaultState(blockState.getBaseState()
|
||||
.withProperty(field_181084_N, EnumFacing.SOUTH)
|
||||
.withProperty(VARIANT, EnumPlantType.SUNFLOWER)
|
||||
.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)
|
||||
.withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, EnumDyeColor.WHITE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, HALF, BotaniaStateProps.DOUBLEFLOWER_VARIANT_1);
|
||||
return new BlockState(this, field_181084_N, VARIANT, HALF, BotaniaStateProps.DOUBLEFLOWER_VARIANT_1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int meta = ((EnumDyeColor) state.getValue(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1)).getMetadata();
|
||||
int meta = state.getValue(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1).getMetadata();
|
||||
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) {
|
||||
meta |= 8;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.block.BlockDoublePlant;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
|
||||
// Silver to black
|
||||
@@ -11,17 +12,21 @@ public class BlockModDoubleFlower2 extends BlockModDoubleFlower {
|
||||
|
||||
public BlockModDoubleFlower2() {
|
||||
super(true);
|
||||
setDefaultState(blockState.getBaseState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2, EnumDyeColor.SILVER));
|
||||
setDefaultState(blockState.getBaseState()
|
||||
.withProperty(field_181084_N, EnumFacing.SOUTH)
|
||||
.withProperty(VARIANT, EnumPlantType.SUNFLOWER)
|
||||
.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)
|
||||
.withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2, EnumDyeColor.SILVER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, HALF, BotaniaStateProps.DOUBLEFLOWER_VARIANT_2);
|
||||
return new BlockState(this, field_181084_N, VARIANT, HALF, BotaniaStateProps.DOUBLEFLOWER_VARIANT_2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int meta = ((EnumDyeColor) state.getValue(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2)).getMetadata() - 8;
|
||||
int meta = state.getValue(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2).getMetadata() - 8;
|
||||
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) {
|
||||
meta |= 8;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class BlockSolidVines extends BlockVine implements ILexiconable {
|
||||
|
||||
@Override
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockMod.class, par1Str);
|
||||
GameRegistry.registerBlock(this, null, par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,37 +12,58 @@ package vazkii.botania.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.RegistrySimple;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.render.SpecialFlowerModel;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
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.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileDaybloom;
|
||||
import vazkii.botania.common.block.tile.TileSpecialFlower;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.integration.coloredlights.LightHelper;
|
||||
@@ -112,12 +133,40 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
setTickRandomly(false);
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
setBlockBounds(0.3F, 0.0F, 0.3F, 0.8F, 1, 0.8F);
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY));
|
||||
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
|
||||
.withProperty(BotaniaStateProps.SUBTILE_ID, "daybloom")
|
||||
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY)
|
||||
);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onModelBake(ModelBakeEvent evt) {
|
||||
// Ignore all vanilla rules, redirect all blockstates to blockstates/specialFlower.json#normal
|
||||
evt.modelManager.getBlockModelShapes().registerBlockWithStateMapper(this, new DefaultStateMapper() {
|
||||
@Override
|
||||
public ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
return new ModelResourceLocation("botania:specialFlower");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, getTypeProperty(), BotaniaStateProps.COLOR);
|
||||
return new ExtendedBlockState(this, new IProperty[] { getTypeProperty(), BotaniaStateProps.COLOR }, new IUnlistedProperty[] { BotaniaStateProps.SUBTILE_ID } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExtendedBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
if (te instanceof TileSpecialFlower && ((TileSpecialFlower) te).getSubTile() != null) {
|
||||
Class<? extends SubTileEntity> clazz = ((TileSpecialFlower) te).getSubTile().getClass();
|
||||
String id = BotaniaAPI.getSubTileStringMapping(clazz);
|
||||
return ((IExtendedBlockState) state).withProperty(BotaniaStateProps.SUBTILE_ID, id);
|
||||
} else {
|
||||
return ((IExtendedBlockState) state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,8 +216,8 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idSpecialFlower;
|
||||
public EnumWorldBlockLayer getBlockLayer() {
|
||||
return EnumWorldBlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -257,11 +306,16 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess world, BlockPos pos, int pass) {
|
||||
return ((EnumDyeColor) world.getBlockState(pos).getValue(BotaniaStateProps.COLOR))
|
||||
public int getRenderColor(IBlockState state) {
|
||||
return ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR))
|
||||
.getMapColor().colorValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess world, BlockPos pos, int pass) {
|
||||
return getRenderColor(world.getBlockState(pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
@@ -280,4 +334,38 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
((TileSpecialFlower) world.getTileEntity(pos)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLandingEffects(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;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(World world, BlockPos pos, EffectRenderer effectRenderer) {
|
||||
if (world.getBlockState(pos).getBlock() == this) {
|
||||
int i = 4;
|
||||
EntityDiggingFX.Factory factory = new EntityDiggingFX.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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.block.BlockModContainer;
|
||||
import vazkii.botania.common.block.tile.TileManaBeacon;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetaNameAndColor;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -51,6 +52,11 @@ public class BlockManaBeacon extends BlockModContainer implements ILexiconable {
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.COLOR);
|
||||
@@ -77,7 +83,7 @@ public class BlockManaBeacon extends BlockModContainer implements ILexiconable {
|
||||
|
||||
@Override
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetaNameAndColor.class, par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetaNameAndColor;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -76,7 +77,7 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
|
||||
|
||||
@Override
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetaNameAndColor.class, par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
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.BlockPos;
|
||||
@@ -47,7 +48,7 @@ public class BlockReeds extends BlockRotatedPillar implements ILexiconable {
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
switch (((EnumFacing.Axis) state.getValue(BotaniaStateProps.AXIS_FACING))) {
|
||||
switch (state.getValue(BotaniaStateProps.AXIS_FACING)) {
|
||||
case Z: return 8;
|
||||
case X: return 4;
|
||||
case Y:
|
||||
@@ -67,6 +68,11 @@ public class BlockReeds extends BlockRotatedPillar implements ILexiconable {
|
||||
return getDefaultState().withProperty(BotaniaStateProps.AXIS_FACING, axis);
|
||||
}
|
||||
|
||||
@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 Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockMod.class, par1Str);
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -39,6 +40,16 @@ public class BlockStarfield extends BlockModContainer implements ILexiconable {
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 0.25F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumWorldBlockLayer getBlockLayer() {
|
||||
return EnumWorldBlockLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.POWERED);
|
||||
|
||||
@@ -33,6 +33,7 @@ import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetaNameAndColor;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -76,7 +77,7 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
|
||||
|
||||
@Override
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
|
||||
GameRegistry.registerBlock(this, ItemBlockWithMetaNameAndColor.class, par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public abstract class BlockModSlab extends BlockSlab implements ILexiconable {
|
||||
}
|
||||
|
||||
public void register() {
|
||||
GameRegistry.registerBlock(this, ItemBlockModSlab.class, name);
|
||||
GameRegistry.registerBlock(this, isDouble() ? null : ItemBlockModSlab.class, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -31,10 +32,10 @@ import java.util.List;
|
||||
public class Block18StoneWall extends BlockModWall {
|
||||
|
||||
public Block18StoneWall() {
|
||||
super(ModFluffBlocks.stone, 4);
|
||||
super(ModFluffBlocks.stone, 0);
|
||||
setHardness(1.5F);
|
||||
setResistance(10F);
|
||||
setDefaultState(getDefaultState().withProperty(BotaniaStateProps.FUTURESTONEWALL_VARIANT, FutureStoneVariant.ANDESITE).withProperty(VARIANT, EnumType.NORMAL));
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.FUTURESTONEWALL_VARIANT, FutureStoneVariant.ANDESITE).withProperty(VARIANT, EnumType.NORMAL));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,7 +53,7 @@ public class Block18StoneWall extends BlockModWall {
|
||||
if (meta < 0 || meta > 3) {
|
||||
meta = 0;
|
||||
}
|
||||
return getDefaultState().withProperty(BotaniaStateProps.FUTURESTONEWALL_VARIANT, FutureStoneVariant.values()[meta]).withProperty(VARIANT, EnumType.NORMAL);
|
||||
return getDefaultState().withProperty(BotaniaStateProps.FUTURESTONEWALL_VARIANT, FutureStoneVariant.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -31,28 +32,28 @@ import java.util.List;
|
||||
public class BlockBiomeStoneWall extends BlockModWall {
|
||||
|
||||
public BlockBiomeStoneWall() {
|
||||
super(ModFluffBlocks.biomeStoneA, 8);
|
||||
super(ModFluffBlocks.biomeStoneA, 0);
|
||||
setHardness(1.5F);
|
||||
setResistance(10F);
|
||||
setDefaultState(getDefaultState().withProperty(BotaniaStateProps.BIOMESTONE_VARIANT, BiomeStoneVariant.FOREST).withProperty(VARIANT, EnumType.NORMAL));
|
||||
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.BIOMESTONEWALL_VARIANT, BiomeStoneVariant.FOREST_COBBLE).withProperty(VARIANT, EnumType.NORMAL));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, VARIANT, UP, NORTH, SOUTH, WEST, EAST, BotaniaStateProps.BIOMESTONE_VARIANT);
|
||||
return new BlockState(this, VARIANT, UP, NORTH, SOUTH, WEST, EAST, BotaniaStateProps.BIOMESTONEWALL_VARIANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ((Enum) state.getValue(BotaniaStateProps.BIOMESTONE_VARIANT)).ordinal();
|
||||
return ((Enum) state.getValue(BotaniaStateProps.BIOMESTONEWALL_VARIANT)).ordinal() - 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta < 0 || meta >= BiomeStoneVariant.values().length) {
|
||||
if (meta < 0 || meta >= BotaniaStateProps.BIOMESTONEWALL_VARIANT.getAllowedValues().size()) {
|
||||
meta = 0;
|
||||
}
|
||||
return getDefaultState().withProperty(BotaniaStateProps.BIOMESTONE_VARIANT, BiomeStoneVariant.values()[meta]).withProperty(VARIANT, EnumType.NORMAL);
|
||||
return getDefaultState().withProperty(BotaniaStateProps.BIOMESTONEWALL_VARIANT, BiomeStoneVariant.values()[meta + 8]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,6 +47,16 @@ public abstract class BlockModWall extends BlockWall implements ILexiconable {
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return super.getActualState(state, world, pos).withProperty(VARIANT, EnumType.NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, VARIANT, UP, NORTH, SOUTH, WEST, EAST);
|
||||
|
||||
@@ -35,6 +35,11 @@ public class BlockDistributor extends BlockModContainer implements ILexiconable
|
||||
setUnlocalizedName(LibBlockNames.DISTRIBUTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileDistributor();
|
||||
|
||||
@@ -45,6 +45,11 @@ public class BlockManaVoid extends BlockModContainer implements ILexiconable, IP
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onTextureStitch(TextureStitchEvent.Pre evt) {
|
||||
|
||||
@@ -192,7 +192,7 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idPool;
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,6 +52,11 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, ILex
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
|
||||
@@ -43,6 +43,11 @@ public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTil
|
||||
public String subTileName = "";
|
||||
SubTileEntity subTile;
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
|
||||
return oldState.getBlock() != newState.getBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubTileEntity getSubTile() {
|
||||
return subTile;
|
||||
|
||||
@@ -18,6 +18,8 @@ import net.minecraftforge.common.ForgeHooks;
|
||||
import vazkii.botania.api.item.IRelic;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class AesirRingRecipe implements IRecipe {
|
||||
|
||||
@Override
|
||||
@@ -44,13 +46,13 @@ public class AesirRingRecipe implements IRecipe {
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting var1) {
|
||||
String soulbind = null;
|
||||
UUID soulbind = null;
|
||||
|
||||
for(int i = 0; i < var1.getSizeInventory(); i++) {
|
||||
ItemStack stack = var1.getStackInSlot(i);
|
||||
if(stack != null) {
|
||||
if(stack.getItem() instanceof IRelic) {
|
||||
String bind = ((IRelic) stack.getItem()).getSoulbindUsername(stack);
|
||||
UUID bind = ((IRelic) stack.getItem()).getSoulbindUuid(stack);
|
||||
if(soulbind == null)
|
||||
soulbind = bind;
|
||||
else if(!soulbind.equals(bind))
|
||||
@@ -60,7 +62,7 @@ public class AesirRingRecipe implements IRecipe {
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(ModItems.aesirRing);
|
||||
((IRelic) ModItems.aesirRing).bindToUsername(soulbind, stack);
|
||||
((IRelic) ModItems.aesirRing).bindToUuid(soulbind, stack);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,10 @@ package vazkii.botania.common.entity;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -107,7 +110,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
boolean spawnPixies = false;
|
||||
boolean anyWithArmor = false;
|
||||
|
||||
List<String> playersWhoAttacked = new ArrayList();
|
||||
List<UUID> playersWhoAttacked = new ArrayList<UUID>();
|
||||
|
||||
private static boolean isPlayingMusic = false;
|
||||
|
||||
@@ -357,8 +360,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
Entity e = par1DamageSource.getEntity();
|
||||
if((par1DamageSource.damageType.equals("player") || e instanceof EntityPixie) && e != null && isTruePlayer(e) && getInvulTime() == 0) {
|
||||
EntityPlayer player = (EntityPlayer) e;
|
||||
if(!playersWhoAttacked.contains(player.getName()))
|
||||
playersWhoAttacked.add(player.getName());
|
||||
if(!playersWhoAttacked.contains(player.getUniqueID()))
|
||||
playersWhoAttacked.add(player.getUniqueID());
|
||||
|
||||
float dmg = par2;
|
||||
boolean crit = false;
|
||||
@@ -445,7 +448,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
entityDropItem(new ItemStack(ModItems.ancientWill, 1, rand.nextInt(6)), 1F);
|
||||
if(ConfigHandler.relicsEnabled) {
|
||||
ItemStack dice = new ItemStack(ModItems.dice);
|
||||
ItemRelic.bindToUsernameS(playersWhoAttacked.get(pl), dice);
|
||||
ItemRelic.bindToUuidS(playersWhoAttacked.get(pl), dice);
|
||||
entityDropItem(dice, 1F);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
*/
|
||||
package vazkii.botania.common.entity;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockVine;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
@@ -21,6 +23,8 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class EntityVineBall extends EntityThrowable {
|
||||
|
||||
public EntityVineBall(World par1World) {
|
||||
@@ -39,18 +43,18 @@ public class EntityVineBall extends EntityThrowable {
|
||||
protected void onImpact(MovingObjectPosition var1) {
|
||||
if(var1 != null) {
|
||||
EnumFacing dir = var1.sideHit;
|
||||
int[] metaPlace = new int[] {
|
||||
1, 4, 8, 2
|
||||
};
|
||||
|
||||
if(dir.getAxis() != EnumFacing.Axis.Y) {
|
||||
Map<EnumFacing, PropertyBool> propMap = ImmutableMap.of(EnumFacing.NORTH, BlockVine.NORTH, EnumFacing.SOUTH, BlockVine.SOUTH,
|
||||
EnumFacing.WEST, BlockVine.WEST, EnumFacing.EAST, BlockVine.EAST);
|
||||
|
||||
if(dir != null && dir.getAxis() != EnumFacing.Axis.Y) {
|
||||
BlockPos pos = var1.getBlockPos().offset(dir);
|
||||
while(pos.getY() > 0) {
|
||||
Block block = worldObj.getBlockState(pos).getBlock();
|
||||
if(block.isAir(worldObj, pos)) {
|
||||
IBlockState state = ModBlocks.solidVines.getDefaultState().withProperty(BlockVine.ALL_FACES[dir.getIndex() + 1], true);
|
||||
IBlockState state = ModBlocks.solidVines.getDefaultState().withProperty(propMap.get(dir.getOpposite()), true);
|
||||
worldObj.setBlockState(pos, state, 1 | 2);
|
||||
worldObj.playAuxSFX(2001, pos, Block.getStateId(state)); // todo 1.8 verify
|
||||
worldObj.playAuxSFX(2001, pos, Block.getStateId(state));
|
||||
pos = pos.down();
|
||||
} else break;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package vazkii.botania.common.item.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBlockWithMetaNameAndColor extends ItemBlockWithMetadataAndName {
|
||||
public ItemBlockWithMetaNameAndColor(Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||
{
|
||||
return this.block.getRenderColor(this.block.getStateFromMeta(stack.getMetadata()));
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import net.minecraft.stats.Achievement;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.achievement.ICraftAchievement;
|
||||
import vazkii.botania.common.achievement.IPickupAchievement;
|
||||
// todo 1.8 revalidate this (used to extend ItemBlockWithMetadata which got removed)
|
||||
|
||||
public class ItemBlockWithMetadataAndName extends ItemBlock implements IPickupAchievement, ICraftAchievement {
|
||||
|
||||
public ItemBlockWithMetadataAndName(Block par2Block) {
|
||||
|
||||
@@ -51,7 +51,6 @@ public class ItemDye extends Item16Colors {
|
||||
TileEntity tile = par3World.getTileEntity(pos);
|
||||
if(tile instanceof IDyablePool) {
|
||||
IDyablePool dyable = (IDyablePool) tile;
|
||||
int itemMeta = par1ItemStack.getItemDamage();
|
||||
if(color != dyable.getColor()) {
|
||||
dyable.setColor(color);
|
||||
par1ItemStack.stackSize--;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.item.relic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
@@ -61,10 +62,10 @@ public class ItemAesirRing extends ItemRelicBauble implements IExtendedWireframe
|
||||
if(stack.getItem() != null && stack.getItem() == this) {
|
||||
event.entityItem.setDead();
|
||||
|
||||
String user = getSoulbindUsername(stack);
|
||||
UUID user = getSoulbindUuid(stack);
|
||||
for(Item item : new Item[] { ModItems.thorRing, ModItems.lokiRing, ModItems.odinRing }) {
|
||||
ItemStack stack1 = new ItemStack(item);
|
||||
bindToUsername(user, stack1);
|
||||
bindToUuid(user, stack1);
|
||||
EntityItem entity = new EntityItem(event.entityItem.worldObj, event.entityItem.posX, event.entityItem.posY, event.entityItem.posZ, stack1);
|
||||
entity.motionX = event.entityItem.motionX;
|
||||
entity.motionY = event.entityItem.motionY;
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
package vazkii.botania.common.item.relic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -30,7 +32,8 @@ import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class ItemRelic extends ItemMod implements IRelic {
|
||||
|
||||
private static final String TAG_SOULBIND = "soulbind";
|
||||
private static final String TAG_SOLBIND_NAME = "soulbind";
|
||||
private static final String TAG_SOULBIND_UUID = "soulbindUuid";
|
||||
|
||||
Achievement achievement;
|
||||
|
||||
@@ -50,15 +53,19 @@ public class ItemRelic extends ItemMod implements IRelic {
|
||||
addBindInfo(p_77624_3_, p_77624_1_, p_77624_2_);
|
||||
}
|
||||
|
||||
public static void addBindInfo(List list, ItemStack stack, EntityPlayer player) {
|
||||
public static void addBindInfo(List<String> list, ItemStack stack, EntityPlayer player) {
|
||||
if(GuiScreen.isShiftKeyDown()) {
|
||||
String bind = getSoulbindUsernameS(stack);
|
||||
if(bind.isEmpty())
|
||||
UUID bind = getSoulbindUuidS(stack);
|
||||
if(bind == null)
|
||||
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.relicUnbound"), list);
|
||||
else {
|
||||
addStringToTooltip(String.format(StatCollector.translateToLocal("botaniamisc.relicSoulbound"), bind), list);
|
||||
String disp = getSoulbindNameS(stack);
|
||||
if (disp.isEmpty()) {
|
||||
disp = bind.toString();
|
||||
}
|
||||
addStringToTooltip(String.format(StatCollector.translateToLocal("botaniamisc.relicSoulbound"), disp), list);
|
||||
if(!isRightPlayer(player, stack))
|
||||
addStringToTooltip(String.format(StatCollector.translateToLocal("botaniamisc.notYourSagittarius"), bind), list);
|
||||
addStringToTooltip(String.format(StatCollector.translateToLocal("botaniamisc.notYourSagittarius"), disp), list);
|
||||
}
|
||||
|
||||
if(stack.getItem() == ModItems.aesirRing)
|
||||
@@ -86,19 +93,28 @@ public class ItemRelic extends ItemMod implements IRelic {
|
||||
tooltip.add(s.replaceAll("&", "\u00a7"));
|
||||
}
|
||||
|
||||
public static String getSoulbindUsernameS(ItemStack stack) {
|
||||
return ItemNBTHelper.getString(stack, TAG_SOULBIND, "");
|
||||
public static UUID getSoulbindUuidS(ItemStack stack) {
|
||||
try {
|
||||
return UUID.fromString(ItemNBTHelper.getString(stack, TAG_SOULBIND_UUID, ""));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Bad text in tag
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSoulbindNameS(ItemStack stack) {
|
||||
return ItemNBTHelper.getString(stack, TAG_SOLBIND_NAME, "");
|
||||
}
|
||||
|
||||
public static void updateRelic(ItemStack stack, EntityPlayer player) {
|
||||
if(stack == null || !(stack.getItem() instanceof IRelic))
|
||||
return;
|
||||
|
||||
String soulbind = getSoulbindUsernameS(stack);
|
||||
if(soulbind.isEmpty()) {
|
||||
UUID soulbind = getSoulbindUuidS(stack);
|
||||
if(soulbind == null) {
|
||||
player.addStat(((IRelic) stack.getItem()).getBindAchievement(), 1);
|
||||
bindToPlayer(player, stack);
|
||||
soulbind = getSoulbindUsernameS(stack);
|
||||
soulbind = getSoulbindUuidS(stack);
|
||||
}
|
||||
|
||||
if(!isRightPlayer(player, stack) && player.ticksExisted % 10 == 0 && (!(stack.getItem() instanceof ItemRelic) || ((ItemRelic) stack.getItem()).shouldDamageWrongPlayer()))
|
||||
@@ -106,19 +122,24 @@ public class ItemRelic extends ItemMod implements IRelic {
|
||||
}
|
||||
|
||||
public static void bindToPlayer(EntityPlayer player, ItemStack stack) {
|
||||
bindToUsernameS(player.getName(), stack);
|
||||
bindToUuidS(player.getUniqueID(), stack);
|
||||
bindToNameS(player.getName(), stack);
|
||||
}
|
||||
|
||||
public static void bindToUsernameS(String username, ItemStack stack) {
|
||||
ItemNBTHelper.setString(stack, TAG_SOULBIND, username);
|
||||
public static void bindToNameS(String playerName, ItemStack stack) {
|
||||
ItemNBTHelper.setString(stack, TAG_SOLBIND_NAME, playerName);
|
||||
}
|
||||
|
||||
public static void bindToUuidS(UUID uuid, ItemStack stack) {
|
||||
ItemNBTHelper.setString(stack, TAG_SOULBIND_UUID, uuid.toString());
|
||||
}
|
||||
|
||||
public static boolean isRightPlayer(EntityPlayer player, ItemStack stack) {
|
||||
return isRightPlayer(player.getName(), stack);
|
||||
return isRightPlayer(player.getUniqueID(), stack);
|
||||
}
|
||||
|
||||
public static boolean isRightPlayer(String player, ItemStack stack) {
|
||||
return getSoulbindUsernameS(stack).equals(player);
|
||||
public static boolean isRightPlayer(UUID uuid, ItemStack stack) {
|
||||
return uuid.equals(getSoulbindUuidS(stack));
|
||||
}
|
||||
|
||||
public static DamageSource damageSource() {
|
||||
@@ -126,13 +147,13 @@ public class ItemRelic extends ItemMod implements IRelic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindToUsername(String playerName, ItemStack stack) {
|
||||
bindToUsernameS(playerName, stack);
|
||||
public void bindToUuid(UUID playerName, ItemStack stack) {
|
||||
bindToUuidS(playerName, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSoulbindUsername(ItemStack stack) {
|
||||
return getSoulbindUsernameS(stack);
|
||||
public UUID getSoulbindUuid(ItemStack stack) {
|
||||
return getSoulbindUuidS(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.item.relic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -64,13 +65,13 @@ public abstract class ItemRelicBauble extends ItemBauble implements IRelic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindToUsername(String playerName, ItemStack stack) {
|
||||
ItemRelic.bindToUsernameS(playerName, stack);
|
||||
public void bindToUuid(UUID playerName, ItemStack stack) {
|
||||
ItemRelic.bindToUuidS(playerName, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSoulbindUsername(ItemStack stack) {
|
||||
return ItemRelic.getSoulbindUsernameS(stack);
|
||||
public UUID getSoulbindUuid(ItemStack stack) {
|
||||
return ItemRelic.getSoulbindUuidS(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -138,7 +138,7 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
for(int x = 0; x < width; x++) {
|
||||
Object input = shaped.getInput()[y * width + x];
|
||||
if(input != null)
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0), true);
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((List<ItemStack>) input).get(0), true);
|
||||
}
|
||||
|
||||
oreDictRecipe = true;
|
||||
@@ -171,7 +171,7 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
|
||||
Object input = shapeless.getInput().get(index);
|
||||
if(input != null)
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0), true);
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((List<ItemStack>) input).get(0), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user