Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
Final additions
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyyTV committed Feb 7, 2021
1 parent 1e1a520 commit af15854
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 35 deletions.
8 changes: 2 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ minecraft {
repositories {
maven {
name = "JEI Maven"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name = "TOP Maven"
url = "http://maven.tterrag.com"
url = "https://dvs1.progwml6.com/files/maven"
}
maven {
name = "Curse Maven"
Expand All @@ -44,8 +40,8 @@ repositories {

dependencies {
deobfCompile "mezz.jei:jei_1.10.2:+"
deobfCompile "curse.maven:theoneprobe-245211:2420012" //1.1x-1.4.7
deobfCompile "curse.maven:hwyla-253449:2433252" //1.8.17-B31_1.10.2
deobfCompile "curse.maven:theoneprobe-245211:2496984" //1.1x-1.4.19
}

processResources {
Expand Down
45 changes: 33 additions & 12 deletions src/main/java/jackyy/dimensionaledibles/block/BlockCakeBase.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package jackyy.dimensionaledibles.block;

import jackyy.dimensionaledibles.block.tile.TileDimensionCake;
import jackyy.dimensionaledibles.util.ITOPInfoProvider;
import jackyy.dimensionaledibles.util.IWailaInfoProvider;
import jackyy.dimensionaledibles.util.Reference;
Expand All @@ -20,12 +21,15 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.DimensionType;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
Expand All @@ -38,6 +42,7 @@
* This is based on the vanilla cake class, but slightly modified and added
* Waila / TOP support.
*/
@SuppressWarnings("deprecation")
public class BlockCakeBase extends Block implements ITOPInfoProvider, IWailaInfoProvider {

public static final PropertyInteger BITES = PropertyInteger.create("bites", 0, 6);
Expand All @@ -52,22 +57,22 @@ public BlockCakeBase() {
setCreativeTab(Reference.TAB);
}

@Override @Deprecated
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return CAKE_AABB[state.getValue(BITES)];
}

@Override @SideOnly(Side.CLIENT) @Deprecated
@Override @SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) {
return state.getCollisionBoundingBox(worldIn, pos);
}

@Override @Deprecated
@Override
public boolean isFullCube(IBlockState state) {
return false;
}

@Override @Deprecated
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
Expand All @@ -92,7 +97,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
return super.canPlaceBlockAt(worldIn, pos) && this.canBlockStay(worldIn, pos);
}

@Override @Deprecated
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn) {
if (!this.canBlockStay(worldIn, pos)) {
worldIn.setBlockToAir(pos);
Expand All @@ -113,7 +118,7 @@ public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return null;
}

@Override @Deprecated
@Override
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BITES, meta);
}
Expand All @@ -133,30 +138,46 @@ protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BITES);
}

@Override @Deprecated
@Override
public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) {
return (7 - blockState.getValue(BITES)) * 2;
}

@Override @Deprecated
@Override
public boolean hasComparatorInputOverride(IBlockState state) {
return true;
}

@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
if (world.getBlockState(data.getPos()).getBlock() instanceof BlockCakeBase) {
Block block = world.getBlockState(data.getPos()).getBlock();
if (block instanceof BlockCakeBase) {
probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER))
.item(new ItemStack(Items.CAKE))
.text(TextFormatting.GREEN + "Bites: ")
.text(TextFormatting.GREEN + I18n.translateToLocal(Reference.MODID + ".bites") + " ")
.progress(6 - blockState.getValue(BITES), 6);
TileEntity tile = world.getTileEntity(data.getPos());
if (tile instanceof TileDimensionCake) {
int dim = ((TileDimensionCake) tile).getDimensionID();
String dimName = DimensionType.getById(dim).getName();
probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER))
.item(new ItemStack(Items.ENDER_PEARL))
.text(TextFormatting.AQUA + I18n.translateToLocal(Reference.MODID + ".dimension") + TextFormatting.WHITE + " " + dimName + " (" + dim + ")");
}
}
}

@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (accessor.getBlockState().getBlock() instanceof BlockCakeBase) {
currenttip.add(TextFormatting.GRAY + "Bites: " + (6 - accessor.getBlockState().getValue(BITES)) + " / 6");
Block block = accessor.getBlockState().getBlock();
if (block instanceof BlockCakeBase) {
currenttip.add(TextFormatting.GRAY + I18n.translateToLocal(Reference.MODID + ".bites") + " " + (6 - accessor.getBlockState().getValue(BITES)) + " / 6");
TileEntity tile = accessor.getWorld().getTileEntity(accessor.getPosition());
if (tile instanceof TileDimensionCake) {
int dim = ((TileDimensionCake) tile).getDimensionID();
String dimName = DimensionType.getById(dim).getName();
currenttip.add(TextFormatting.GRAY + I18n.translateToLocal(Reference.MODID + ".dimension") + " " + dimName + " (" + dim + ")");
}
}
return currenttip;
}
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/jackyy/dimensionaledibles/compat/JEICompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ public void registerIngredients(IModIngredientRegistration registry) {
public void register(IModRegistry registry) {
//End Cake
registry.addDescription(new ItemStack(ModBlocks.endCake),
I18n.format(Reference.MODID + ".end_cake.jeidesc",
TextFormatting.DARK_PURPLE + Item.REGISTRY.getObject(new ResourceLocation(ModConfig.tweaks.endCake.fuel)).getItemStackDisplayName(
new ItemStack(Item.REGISTRY.getObject(new ResourceLocation(ModConfig.tweaks.endCake.fuel)))) + TextFormatting.RESET
I18n.format(
Reference.MODID + ".end_cake.jeidesc",
TextFormatting.DARK_PURPLE + new ItemStack(Item.REGISTRY.getObject(new ResourceLocation(ModConfig.tweaks.endCake.fuel))).getDisplayName() + TextFormatting.RESET
));
//Nether Cake
registry.addDescription(new ItemStack(ModBlocks.netherCake),
I18n.format(Reference.MODID + ".nether_cake.jeidesc",
TextFormatting.DARK_PURPLE + Item.REGISTRY.getObject(new ResourceLocation(ModConfig.tweaks.netherCake.fuel)).getItemStackDisplayName(
new ItemStack(Item.REGISTRY.getObject(new ResourceLocation(ModConfig.tweaks.netherCake.fuel)))) + TextFormatting.RESET
I18n.format(
Reference.MODID + ".nether_cake.jeidesc",
TextFormatting.DARK_PURPLE + new ItemStack(Item.REGISTRY.getObject(new ResourceLocation(ModConfig.tweaks.netherCake.fuel))).getDisplayName() + TextFormatting.RESET
));
//Overworld Cake
registry.addDescription(new ItemStack(ModBlocks.overworldCake),
I18n.format(Reference.MODID + ".overworld_cake.jeidesc",
TextFormatting.DARK_PURPLE + Item.REGISTRY.getObject(new ResourceLocation(ModConfig.tweaks.overworldCake.fuel)).getItemStackDisplayName(
new ItemStack(Item.REGISTRY.getObject(new ResourceLocation(ModConfig.tweaks.overworldCake.fuel)))) + TextFormatting.RESET
I18n.format(
Reference.MODID + ".overworld_cake.jeidesc",
TextFormatting.DARK_PURPLE + new ItemStack(Item.REGISTRY.getObject(new ResourceLocation(ModConfig.tweaks.overworldCake.fuel))).getDisplayName() + TextFormatting.RESET
));
//Ender Apple
registry.addDescription(new ItemStack(ModItems.enderApple),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase
}

@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
playerIn.setActiveHand(hand);
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
player.setActiveHand(hand);
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.DimensionType;
import net.minecraft.world.World;

import java.util.List;

@SuppressWarnings("deprecation")
public class ItemBlockCustomCake extends ItemBlock {

public ItemBlockCustomCake() {
Expand All @@ -27,7 +32,7 @@ public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.EPIC;
}

@Override @SuppressWarnings("deprecation")
@Override
public String getItemStackDisplayName(ItemStack stack) {
return I18n.translateToLocalFormatted("item." + Reference.MODID + ".custom_cake.name", getCakeName(stack));
}
Expand All @@ -45,7 +50,15 @@ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, B
return placed;
}

@SuppressWarnings("deprecation")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
int dim = getDimID(stack);
String dimName = DimensionType.getById(dim).getName();
tooltip.add(TextFormatting.AQUA + I18n.translateToLocal(Reference.MODID + ".dimension") + TextFormatting.WHITE + " " + dimName + " (" + dim + ")");
}


public String getCakeName(ItemStack stack) {
NBTTagCompound nbt = stack.getTagCompound();
if (nbt == null || !nbt.hasKey("cakeName")) {
Expand Down
22 changes: 20 additions & 2 deletions src/main/java/jackyy/dimensionaledibles/item/ItemCustomApple.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.DimensionType;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.relauncher.Side;
Expand All @@ -22,6 +24,7 @@
import javax.annotation.Nonnull;
import java.util.List;

@SuppressWarnings("deprecation")
public class ItemCustomApple extends ItemAppleBase {

public ItemCustomApple() {
Expand Down Expand Up @@ -107,12 +110,19 @@ public void getSubItems(@Nonnull Item item, CreativeTabs tab, List<ItemStack> li
}
}

@Override @SuppressWarnings("deprecation")
@Override
public String getItemStackDisplayName(ItemStack stack) {
return I18n.translateToLocalFormatted("item." + Reference.MODID + ".custom_apple.name", getAppleName(stack));
}

@SuppressWarnings("deprecation")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
int dim = getDimID(stack);
String dimName = DimensionType.getById(dim).getName();
tooltip.add(TextFormatting.AQUA + I18n.translateToLocal(Reference.MODID + ".dimension") + TextFormatting.WHITE + " " + dimName + " (" + dim + ")");
}

public String getAppleName(ItemStack stack) {
NBTTagCompound nbt = stack.getTagCompound();
if (nbt == null || !nbt.hasKey("appleName")) {
Expand All @@ -121,4 +131,12 @@ public String getAppleName(ItemStack stack) {
return nbt.getString("appleName");
}

public int getDimID(ItemStack stack) {
NBTTagCompound nbt = stack.getTagCompound();
if (nbt == null || !nbt.hasKey("dimID")) {
return 0;
}
return nbt.getInteger("dimID");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public final class Reference {
public static final String VERSION = "1.3.2";
public static final String MCVERSION = "[1.10,1.11)";

public static final String DEPENDS = "after:Waila;after:theoneprobe;";
public static final String DEPENDS = "after:Waila;after:theoneprobe;after:JEI;";

public static final String GUIFACTORY = "jackyy.dimensionaledibles.registry.ConfigGuiFactory";

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/dimensionaledibles/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ dimensionaledibles.error.end_portal_disabled=Activation of the End Portal has be

#Misc
dimensionaledibles.custom=Custom
dimensionaledibles.bites=Bites:
dimensionaledibles.dimension=Dimension:

0 comments on commit af15854

Please sign in to comment.