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

Commit

Permalink
1.3.2 Update
Browse files Browse the repository at this point in the history
- Added GunpowderLib as a required dependency

- Added dimension info for custom cakes to show in Waila and The One Probe

- Added a dimension tooltip for custom cakes and apples

- Made some text translatable instead of hardcoded

- Removed hovering dimension text from non-custom cakes, also made the hovering text to only show when player is looking at the custom cakes

- Slightly enhanced the JEI info to highlight the text of the item needed to fill a cake

- Made all the apples to be usable in creative mode, closes #22

- Fixed a few typos in the config file, closes #23
  • Loading branch information
JackyyTV committed Feb 7, 2021
1 parent fa4f1bb commit 81102c1
Show file tree
Hide file tree
Showing 31 changed files with 410 additions and 286 deletions.
11 changes: 8 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,27 @@ minecraft {
repositories {
maven {
name = "JEI Maven"
url "http://dvs1.progwml6.com/files/maven"
url = "https://dvs1.progwml6.com/files/maven"
}
maven {
name = "Hwyla Maven"
url "http://maven.tehnut.info"
url = "https://maven.tehnut.info"
}
maven {
name = "TOP Maven"
url = "http://maven.tterrag.com"
url = "https://maven.tterrag.com"
}
maven {
name = "Curse Maven"
url = "https://www.cursemaven.com"
}
}

dependencies {
deobfCompile "mezz.jei:jei_1.12.2:+"
deobfCompile "mcp.mobius.waila:Hwyla:1.8.26-B41_1.12.2"
deobfCompile "mcjty.theoneprobe:TheOneProbe-1.12:1.12-1.4.+"
deobfCompile "curse.maven:gunpowderlib-356646:3168863" //1.12.2-1.1
}

processResources {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx4G
mc_version=1.12.2
forge_version=1.12.2-14.23.5.2825
mod_version=1.3.1
forge_version=1.12.2-14.23.5.2847
mod_version=1.3.2
mappings_version=stable_39
25 changes: 4 additions & 21 deletions src/main/java/jackyy/dimensionaledibles/DimensionalEdibles.java
Original file line number Diff line number Diff line change
@@ -1,35 +1,18 @@
package jackyy.dimensionaledibles;

import jackyy.dimensionaledibles.proxy.CommonProxy;
import jackyy.dimensionaledibles.registry.ModBlocks;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import jackyy.dimensionaledibles.util.Reference;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Mod(modid = DimensionalEdibles.MODID, name = DimensionalEdibles.MODNAME, version = DimensionalEdibles.VERSION, acceptedMinecraftVersions = DimensionalEdibles.MCVERSION, dependencies = DimensionalEdibles.DEPENDS, certificateFingerprint = "@FINGERPRINT@", useMetadata = true)
@Mod(modid = Reference.MODID, name = Reference.MODNAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.MCVERSION, dependencies = Reference.DEPENDS, certificateFingerprint = "@FINGERPRINT@", useMetadata = true)
public class DimensionalEdibles {

public static final String VERSION = "1.3.1";
public static final String MCVERSION = "[1.12,1.13)";
public static final String MODID = "dimensionaledibles";
public static final String MODNAME = "Dimensional Edibles";
public static final String DEPENDS = "after:waila;after:theoneprobe;after:jei@[4.12.0.0,);";
public static final CreativeTabs TAB = new CreativeTabs(MODID) {
@Override
public ItemStack createIcon() {
return new ItemStack(ModBlocks.endCake);
}
};
public static Logger logger = LogManager.getLogger(MODNAME);

@SidedProxy(serverSide = "jackyy.dimensionaledibles.proxy.CommonProxy", clientSide = "jackyy.dimensionaledibles.proxy.ClientProxy")
@SidedProxy(serverSide = Reference.COMMON_PROXY, clientSide = Reference.CLIENT_PROXY)
public static CommonProxy proxy;

@Mod.EventHandler
Expand All @@ -49,7 +32,7 @@ public void postInit(FMLPostInitializationEvent event) {

@Mod.EventHandler
public void onFingerprintViolation(FMLFingerprintViolationEvent event) {
logger.warn("Invalid fingerprint detected! The file " + event.getSource().getName() + " may have been modified. This will NOT be supported by the mod author!");
Reference.LOGGER.warn("Invalid fingerprint detected! The file " + event.getSource().getName() + " may have been modified. This will NOT be supported by the mod author!");
}

}
53 changes: 37 additions & 16 deletions src/main/java/jackyy/dimensionaledibles/block/BlockCakeBase.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package jackyy.dimensionaledibles.block;

import jackyy.dimensionaledibles.DimensionalEdibles;
import jackyy.dimensionaledibles.util.ITOPInfoProvider;
import jackyy.dimensionaledibles.util.IWailaInfoProvider;
import jackyy.dimensionaledibles.block.tile.TileDimensionCake;
import jackyy.dimensionaledibles.util.Reference;
import jackyy.gunpowderlib.compat.ITOPInfoProvider;
import jackyy.gunpowderlib.compat.IWailaInfoProvider;
import jackyy.gunpowderlib.helper.StringHelper;
import mcjty.theoneprobe.api.ElementAlignment;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
Expand All @@ -20,12 +22,14 @@
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.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 @@ -49,25 +54,25 @@ public BlockCakeBase() {
setTickRandomly(true);
setHardness(0.5F);
setSoundType(SoundType.CLOTH);
setCreativeTab(DimensionalEdibles.TAB);
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, BlockPos fromPos) {
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 + StringHelper.localize(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 + StringHelper.localize(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 + StringHelper.localize(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 + StringHelper.localize(Reference.MODID, "dimension") + " " + dimName + " (" + dim + ")");
}
}
return currenttip;
}
Expand Down
33 changes: 14 additions & 19 deletions src/main/java/jackyy/dimensionaledibles/block/BlockCustomCake.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package jackyy.dimensionaledibles.block;

import jackyy.dimensionaledibles.DimensionalEdibles;
import jackyy.dimensionaledibles.block.tile.TileDimensionCake;
import jackyy.dimensionaledibles.registry.ModConfig;
import jackyy.dimensionaledibles.util.Reference;
import jackyy.dimensionaledibles.util.TeleporterHandler;
import jackyy.gunpowderlib.helper.NBTHelper;
import jackyy.gunpowderlib.helper.ObjectHelper;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
Expand All @@ -32,9 +32,8 @@ public class BlockCustomCake extends BlockCakeBase implements ITileEntityProvide
private int customZ = 0;

public BlockCustomCake() {
super();
setRegistryName(DimensionalEdibles.MODID + ":custom_cake");
setTranslationKey(DimensionalEdibles.MODID + ".custom_cake");
setRegistryName(Reference.MODID + ":custom_cake");
setTranslationKey(Reference.MODID + ".custom_cake");
}

@Override
Expand All @@ -51,21 +50,21 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
try {
String[] parts = s.split(",");
if (parts.length < 2) {
DimensionalEdibles.logger.log(Level.ERROR, s + " is not a valid input line! Format needs to be: <dimID>, <cakeFuel>");
Reference.LOGGER.log(Level.ERROR, s + " is not a valid input line! Format needs to be: <dimID>, <cakeFuel>");
continue;
}
if (Integer.parseInt(parts[0].trim()) == dimension) {
fuel = parts[1].trim();
}
} catch (NumberFormatException e) {
DimensionalEdibles.logger.log(Level.ERROR, s + " is not a valid line input! The dimension ID needs to be a number!");
Reference.LOGGER.log(Level.ERROR, s + " is not a valid line input! The dimension ID needs to be a number!");
}
}
for (String s : ModConfig.tweaks.customEdible.customCoords) {
try {
String[] parts = s.split(",");
if (parts.length < 4) {
DimensionalEdibles.logger.log(Level.ERROR, s + " is not a valid input line! Format needs to be: <dimID>, <x>, <y>, <z>");
Reference.LOGGER.log(Level.ERROR, s + " is not a valid input line! Format needs to be: <dimID>, <x>, <y>, <z>");
continue;
}
if (Integer.parseInt(parts[0].trim()) == dimension) {
Expand All @@ -74,10 +73,10 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
customZ = Integer.parseInt(parts[3].trim());
}
} catch (NumberFormatException e) {
DimensionalEdibles.logger.log(Level.ERROR, s + " is not a valid line input! The dimension ID needs to be a number!");
Reference.LOGGER.log(Level.ERROR, s + " is not a valid line input! The dimension ID needs to be a number!");
}
}
if (!stack.isEmpty() && stack.getItem() == Item.REGISTRY.getObject(new ResourceLocation(fuel))) {
if (!stack.isEmpty() && stack.getItem() == ObjectHelper.getItemByName(fuel)) {
if (meta >= 0) {
world.setBlockState(pos, state.withProperty(BITES, meta), 2);
if (!player.capabilities.isCreativeMode) {
Expand Down Expand Up @@ -137,25 +136,21 @@ public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
try {
String[] parts = s.split(",");
if (parts.length < 2) {
DimensionalEdibles.logger.log(Level.ERROR, s + " is not a valid input line! Format needs to be: <dimID>, <cakeName>");
Reference.LOGGER.log(Level.ERROR, s + " is not a valid input line! Format needs to be: <dimID>, <cakeName>");
continue;
}
int dimension = Integer.parseInt(parts[0].trim());
if (DimensionManager.isDimensionRegistered(dimension)) {
stack = new ItemStack(this);
NBTTagCompound nbt = stack.getTagCompound();
if (nbt == null) {
nbt = new NBTTagCompound();
stack.setTagCompound(nbt);
}
NBTTagCompound nbt = NBTHelper.getTag(stack);
nbt.setInteger("dimID", dimension);
nbt.setString("cakeName", parts[1].trim());
list.add(stack);
} else {
DimensionalEdibles.logger.log(Level.ERROR, parts[0] + " is not a valid dimension ID! (Needs to be a number)");
Reference.LOGGER.log(Level.ERROR, parts[0] + " is not a valid dimension ID! (Needs to be a number)");
}
} catch (NumberFormatException e) {
DimensionalEdibles.logger.log(Level.ERROR, s + " is not a valid line input! The dimension ID needs to be a number!");
Reference.LOGGER.log(Level.ERROR, s + " is not a valid line input! The dimension ID needs to be a number!");
}
}
}
Expand Down
22 changes: 6 additions & 16 deletions src/main/java/jackyy/dimensionaledibles/block/BlockEndCake.java
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
package jackyy.dimensionaledibles.block;

import jackyy.dimensionaledibles.DimensionalEdibles;
import jackyy.dimensionaledibles.block.tile.TileDimensionCake;
import jackyy.dimensionaledibles.registry.ModConfig;
import jackyy.dimensionaledibles.util.Reference;
import jackyy.dimensionaledibles.util.TeleporterHandler;
import net.minecraft.block.ITileEntityProvider;
import jackyy.gunpowderlib.helper.ObjectHelper;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockEndCake extends BlockCakeBase implements ITileEntityProvider {
public class BlockEndCake extends BlockCakeBase {

public BlockEndCake() {
super();
setRegistryName(DimensionalEdibles.MODID + ":end_cake");
setTranslationKey(DimensionalEdibles.MODID + ".end_cake");
setRegistryName(Reference.MODID + ":end_cake");
setTranslationKey(Reference.MODID + ".end_cake");
}

@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
int meta = getMetaFromState(world.getBlockState(pos)) - 1;
ItemStack stack = player.getHeldItem(hand);
if (!stack.isEmpty() && stack.getItem() == Item.REGISTRY.getObject(new ResourceLocation(ModConfig.tweaks.endCake.fuel))) {
if (!stack.isEmpty() && stack.getItem() == ObjectHelper.getItemByName(ModConfig.tweaks.endCake.fuel)) {
if (meta >= 0) {
world.setBlockState(pos, state.withProperty(BITES, meta), 2);
if (!player.capabilities.isCreativeMode) {
Expand Down Expand Up @@ -92,9 +87,4 @@ public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
list.add(new ItemStack(this));
}

@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileDimensionCake(1, "End");
}

}
Loading

0 comments on commit 81102c1

Please sign in to comment.