Skip to content

Commit

Permalink
Fix fences not working with leaads and possibly more things
Browse files Browse the repository at this point in the history
Walking sounds still don't work right but I may ignore that for now.
Also slight code cleanup using isEnabled instead of a config var and other random things I saw while looking around
  • Loading branch information
Roadhog360 committed Nov 21, 2023
1 parent 4564a06 commit 14d0f66
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/main/java/ganymedes01/etfuturum/EtFuturum.java
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ public void postInit(FMLPostInitializationEvent event) {

@EventHandler
public void onLoadComplete(FMLLoadCompleteEvent e) {

ConfigBase.postInit();

EtFuturumWorldGenerator.INSTANCE.postInit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import ganymedes01.etfuturum.api.mappings.RegistryMapping;
import ganymedes01.etfuturum.client.sound.ModSounds;
import ganymedes01.etfuturum.configuration.configs.ConfigBlocksItems;
import ganymedes01.etfuturum.configuration.configs.ConfigSounds;
import ganymedes01.etfuturum.core.utils.Logger;
import ganymedes01.etfuturum.core.utils.Utils;
import ganymedes01.etfuturum.recipes.ModRecipes;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
Expand Down Expand Up @@ -197,8 +197,9 @@ public static void init() {

boolean saltyModOre = oreDeep.getClass().getName().toLowerCase().contains("saltymod");

if (ConfigSounds.newBlockSounds && (oreDeep.stepSound == Block.soundTypeStone || saltyModOre)) {
oreDeep.setStepSound(ModSounds.soundDeepslate);//SaltyMod introduces a deepslate salt ore but it assumes an old resource domain, making it silent on new EFR versions
if (oreDeep.stepSound == Block.soundTypeStone || saltyModOre) {
Utils.setBlockSound(oreDeep, ModSounds.soundDeepslate);
//SaltyMod introduces a deepslate salt ore but it assumes an old resource domain, making it silent on new EFR versions
}

ItemStack
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package ganymedes01.etfuturum.blocks;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import ganymedes01.etfuturum.EtFuturum;
import ganymedes01.etfuturum.ModBlocks;
import ganymedes01.etfuturum.configuration.configs.ConfigBlocksItems;
import ganymedes01.etfuturum.configuration.configs.ConfigFunctions;
import ganymedes01.etfuturum.lib.RenderIDs;
import net.minecraft.block.Block;
Expand Down Expand Up @@ -89,7 +90,11 @@ public String getNameFor(ItemStack stack) {

@Override
public int getRenderType() {
return RenderIDs.FENCE;
//We need to do this because some things stupidly check if there's a fence by checking if the render type is 11 and not if it's instance of Fence!!!
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
return RenderIDs.FENCE;
}
return super.getRenderType();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public BlockModelBase(int modelID) {

@Override
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
if (block.getRenderType() == 2) {
if (block.getRenderBlockPass() == 2) {
OpenGLHelper.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGLHelper.enableBlend();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRe

@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
GameProfile profile = stack.hasTagCompound() ? profile = getGameProfile(stack) : null;
GameProfile profile = stack.hasTagCompound() ? getGameProfile(stack) : null;

switch (type) {
case ENTITY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1123,16 +1123,18 @@ public void dropEvent(LivingDropsEvent event) {
}

Random rand = event.entityLiving.worldObj.rand;
if (ConfigBlocksItems.enableMutton && event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot") && event.entityLiving instanceof EntitySheep) {
if (ModItems.MUTTON_RAW.isEnabled() && ModItems.MUTTON_COOKED.isEnabled()
&& event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot") && event.entityLiving instanceof EntitySheep) {
int amount = rand.nextInt(3) + 1 + rand.nextInt(1 + event.lootingLevel);
for (int i = 0; i < amount; i++)
if (event.entityLiving.isBurning())
if (event.entityLiving.isBurning()) {
addDrop(new ItemStack(ModItems.MUTTON_COOKED.get()), event.entityLiving, event.drops);
else
} else {
addDrop(new ItemStack(ModItems.MUTTON_RAW.get()), event.entityLiving, event.drops);
}
}

if (ConfigBlocksItems.enableWitherRose && event.entity instanceof EntityLivingBase && event.source.getEntity() instanceof EntityWither) {
if (ModBlocks.WITHER_ROSE.isEnabled() && event.entity instanceof EntityLivingBase && event.source.getEntity() instanceof EntityWither) {
World world = event.entity.worldObj;
Entity entity = event.entity;
if (world.getGameRules().getGameRuleBooleanValue("mobGriefing") && ModBlocks.WITHER_ROSE.get().canPlaceBlockAt(world, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ private void registerItemRenderers() {
}
if (ConfigFunctions.inventoryBedModels) {
MinecraftForgeClient.registerItemRenderer(Items.bed, new Item3DBedRenderer((BlockBed) Blocks.bed));
if (ConfigBlocksItems.enableDyedBeds) {
for (int i = 0; i < ModBlocks.BEDS.length; i++) {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.BEDS[i].get()), new Item3DBedRenderer((BlockBed) ModBlocks.BEDS[i].get()));
for (ModBlocks bed : ModBlocks.BEDS) {
if (bed.isEnabled()) {
MinecraftForgeClient.registerItemRenderer(bed.getItem(), new Item3DBedRenderer((BlockBed) bed.get()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ganymedes01.etfuturum.entities;

import ganymedes01.etfuturum.ModItems;
import ganymedes01.etfuturum.configuration.configs.ConfigBlocksItems;
import ganymedes01.etfuturum.configuration.configs.ConfigTweaks;
import ganymedes01.etfuturum.core.utils.Utils;
import ganymedes01.etfuturum.core.utils.helpers.BlockPos;
Expand Down Expand Up @@ -561,7 +560,7 @@ public boolean isAttachedToBlock() {
}

protected Item getDropItem() {
return ConfigBlocksItems.enableShulkerBoxes ? ModItems.SHULKER_SHELL.get() : null;
return ModItems.SHULKER_SHELL.isEnabled() ? ModItems.SHULKER_SHELL.get() : null;
}


Expand All @@ -576,7 +575,7 @@ protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) {

float chance = rand.nextFloat();

chance += p_70628_2_ * 0.0625;
chance += (float) (p_70628_2_ * 0.0625);

if (item != null && chance > 0.5) {
this.dropItem(item, 1);
Expand Down

0 comments on commit 14d0f66

Please sign in to comment.