Commit 69efcebf authored by primetoxinz's avatar primetoxinz

Large refactor. Use Quark Module system for Hardcore Features and some...

Large refactor. Use Quark Module system for Hardcore Features and some configurable tweaks. Improve documentation in Config.
parent 424d0dde
......@@ -21,28 +21,21 @@ compileJava {
}
minecraft {
version = "1.11.2-13.20.0.2233"
version = "1.11.2-13.20.0.2282"
runDir = "run"
mappings = "snapshot_20161220"
}
repositories {
maven {
name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven'
}
maven {
name "Base"
url "http://blamejared.com/maven"
}
maven { url 'http://dvs1.progwml6.com/files/maven' }
maven { url "http://blamejared.com/maven" }
maven { url "http://maven.amadornes.com/" }
}
dependencies {
deobfCompile "mezz.jei:jei_1.11.2:+"
deobfCompile "mezz.jei:jei_1.11.2:+"
deobfCompile "MineTweaker3:MineTweaker3-API:+"
deobfCompile "com.blamejared:MTLib:2.+"
runtime "MineTweaker3:MineTweaker3-MC1112-Main:+"
deobfCompile "MCMultiPart2:MCMultiPart-exp:+"
}
jar {
......@@ -68,11 +61,11 @@ processResources {
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
expand 'version': project.version, 'mcversion': project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
......
This diff is collapsed.
package betterwithmods.client.gui;
import betterwithmods.BWMod;
import betterwithmods.config.BWConfig;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.fml.client.config.DummyConfigElement;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.IConfigElement;
import java.util.ArrayList;
import java.util.List;
/**
* Created by tyler on 9/14/16.
*/
public class BWGuiConfig extends GuiConfig {
public BWGuiConfig(GuiScreen parentScreen) {
super(parentScreen,
getConfigElements(), BWMod.MODID, false, false, GuiConfig.getAbridgedConfigPath(BWConfig.config.toString()));
}
/**
* Compiles a list of config elements
*/
private static List<IConfigElement> getConfigElements() {
List<IConfigElement> list = new ArrayList<>();
//Add categories to config GUI
list.add(categoryElement(BWConfig.HARDCORE, "Hardcore", "bwm.config.hardcore"));
list.add(categoryElement(BWConfig.DEBUG, "Debug", "bwm.config.debug"));
list.add(categoryElement(BWConfig.VANILLA_TWEAKS, "Vanilla Tweaks", "bwm.config.vanilla_tweaks"));
list.add(categoryElement(BWConfig.PULLEY, "Pulley", "bwm.config.pulley"));
list.add(categoryElement(BWConfig.MOD_COMPAT, "Mod Compat", "bwm.config.mod_compat"));
return list;
}
/**
* Creates a button linking to another screen where all options of the category are available
*/
private static IConfigElement categoryElement(String category, String name, String tooltip_key) {
return new DummyConfigElement.DummyCategoryElement(name, tooltip_key,
new ConfigElement(BWConfig.config.getCategory(category)).getChildElements());
}
}
package betterwithmods.client.gui;
import betterwithmods.BWMod;
import betterwithmods.module.ModuleLoader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.fml.client.IModGuiFactory;
import net.minecraftforge.fml.client.config.DummyConfigElement;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.IConfigElement;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
......@@ -12,7 +20,17 @@ import java.util.Set;
public class BWGuiFactory implements IModGuiFactory {
@Override
public void initialize(Minecraft minecraftInstance) {
// NO-OP
}
@Override
public boolean hasConfigGui() {
return true;
}
@Override
public GuiScreen createConfigGui(GuiScreen parentScreen) {
return new BWGuiConfig(parentScreen);
}
@Override
......@@ -25,9 +43,28 @@ public class BWGuiFactory implements IModGuiFactory {
return null;
}
@SuppressWarnings("deprecation")
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
return null;
}
public static class BWGuiConfig extends GuiConfig {
public BWGuiConfig(GuiScreen parentScreen) {
super(parentScreen, getAllElements(), BWMod.MODID, false, false, GuiConfig.getAbridgedConfigPath(ModuleLoader.config.toString()));
}
public static List<IConfigElement> getAllElements() {
List<IConfigElement> list = new ArrayList();
Set<String> categories = ModuleLoader.config.getCategoryNames();
for(String s : categories)
if(!s.contains("."))
list.add(new DummyConfigElement.DummyCategoryElement(s, s, new ConfigElement(ModuleLoader.config.getCategory(s)).getChildElements()));
return list;
}
}
}
package betterwithmods.client.render;
import betterwithmods.BWMod;
import betterwithmods.config.BWConfig;
import betterwithmods.event.BreedingHardnessEvent;
import betterwithmods.module.ModuleLoader;
import betterwithmods.module.gameplay.Gameplay;
import net.minecraft.client.renderer.entity.RenderCow;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.passive.EntityCow;
......@@ -16,8 +17,8 @@ import net.minecraft.util.ResourceLocation;
* @version 11/15/16
*/
public class RenderCowHarness extends RenderCow {
private static final ResourceLocation HARNESS = BWConfig.kidFriendly ? new ResourceLocation(BWMod.MODID, "textures/entity/cow_harness_kf.png") : new ResourceLocation(BWMod.MODID, "textures/entity/cow_harness.png");
private static final ResourceLocation HARNESS = new ResourceLocation(BWMod.MODID, "textures/entity/cow_harness.png");
private static final ResourceLocation HARNESS_KF = new ResourceLocation(BWMod.MODID, "textures/entity/cow_harness_kf.png");
public RenderCowHarness(RenderManager renderManagerIn) {
super(renderManagerIn);
}
......@@ -25,7 +26,7 @@ public class RenderCowHarness extends RenderCow {
@Override
protected ResourceLocation getEntityTexture(EntityCow entity) {
if (BreedingHardnessEvent.getHarness(entity) != ItemStack.EMPTY)
return HARNESS;
return Gameplay.kidFriendly ? HARNESS_KF : HARNESS;
return super.getEntityTexture(entity);
}
}
package betterwithmods.client.render;
import betterwithmods.BWMod;
import betterwithmods.config.BWConfig;
import betterwithmods.event.BreedingHardnessEvent;
import betterwithmods.module.ModuleLoader;
import betterwithmods.module.gameplay.Gameplay;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPig;
import net.minecraft.entity.passive.EntityPig;
......@@ -16,8 +17,8 @@ import net.minecraft.util.ResourceLocation;
* @version 11/15/16
*/
public class RenderPigHarness extends RenderPig {
private static final ResourceLocation HARNESS = BWConfig.kidFriendly ? new ResourceLocation(BWMod.MODID, "textures/entity/pig_harness_kf.png") : new ResourceLocation(BWMod.MODID, "textures/entity/pig_harness.png");
private static final ResourceLocation HARNESS = new ResourceLocation(BWMod.MODID, "textures/entity/pig_harness.png");
private static final ResourceLocation HARNESS_KF = new ResourceLocation(BWMod.MODID, "textures/entity/pig_harness_kf.png");
public RenderPigHarness(RenderManager renderManagerIn) {
super(renderManagerIn);
}
......@@ -25,7 +26,7 @@ public class RenderPigHarness extends RenderPig {
@Override
protected ResourceLocation getEntityTexture(EntityPig entity) {
if (BreedingHardnessEvent.getHarness(entity) != ItemStack.EMPTY)
return HARNESS;
return Gameplay.kidFriendly ? HARNESS_KF : HARNESS;
return super.getEntityTexture(entity);
}
}
package betterwithmods.client.render;
import betterwithmods.BWMod;
import betterwithmods.config.BWConfig;
import betterwithmods.event.BreedingHardnessEvent;
import betterwithmods.module.ModuleLoader;
import betterwithmods.module.gameplay.Gameplay;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderSheep;
import net.minecraft.entity.passive.EntitySheep;
......@@ -16,8 +17,8 @@ import net.minecraft.util.ResourceLocation;
* @version 11/15/16
*/
public class RenderSheepHarness extends RenderSheep {
private static final ResourceLocation HARNESS = BWConfig.kidFriendly ? new ResourceLocation(BWMod.MODID, "textures/entity/sheep_harness_kf.png") : new ResourceLocation(BWMod.MODID, "textures/entity/sheep_harness.png");
private static final ResourceLocation HARNESS = new ResourceLocation(BWMod.MODID, "textures/entity/sheep_harness.png");
private static final ResourceLocation HARNESS_KF = new ResourceLocation(BWMod.MODID, "textures/entity/sheep_harness_kf.png");
public RenderSheepHarness(RenderManager renderManagerIn) {
super(renderManagerIn);
}
......@@ -25,7 +26,7 @@ public class RenderSheepHarness extends RenderSheep {
@Override
protected ResourceLocation getEntityTexture(EntitySheep entity) {
if (BreedingHardnessEvent.getHarness(entity) != ItemStack.EMPTY)
return HARNESS;
return Gameplay.kidFriendly ? HARNESS_KF : HARNESS;
return super.getEntityTexture(entity);
}
}
......@@ -9,7 +9,6 @@ import betterwithmods.client.BWCreativeTabs;
import betterwithmods.client.BWStateMapper;
import betterwithmods.common.items.*;
import betterwithmods.common.items.tools.*;
import betterwithmods.config.BWConfig;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPlanks;
import net.minecraft.client.renderer.block.model.ModelBakery;
......
package betterwithmods.common.blocks;
import betterwithmods.BWMod;
import betterwithmods.config.BWConfig;
import betterwithmods.module.GlobalConfig;
import betterwithmods.util.DirUtils;
import betterwithmods.util.player.Profiles;
import net.minecraft.block.Block;
......@@ -34,7 +34,7 @@ public class BehaviorDefaultDispenseBlock extends BehaviorDefaultDispenseItem {
FakePlayer fake = FakePlayerFactory.get((WorldServer) world, Profiles.BWMDISP);
fake.setHeldItem(EnumHand.MAIN_HAND, stack);
DirUtils.setEntityOrientationFacing(fake, facing.getOpposite());
if (BWConfig.debug)
if (GlobalConfig.debug)
BWMod.logger.debug("Better With Mods FakePlayer ID: " + fake.getUniqueID());
if (stack.getItem() instanceof ItemBlock && (world.isAirBlock(check) || world.getBlockState(check).getBlock().isReplaceable(world, check))) {
Block block = ((ItemBlock) stack.getItem()).getBlock();
......
package betterwithmods.common.blocks;
import betterwithmods.BWMod;
import betterwithmods.config.BWConfig;
import betterwithmods.module.GlobalConfig;
import betterwithmods.util.DirUtils;
import betterwithmods.util.player.Profiles;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
......@@ -28,7 +28,7 @@ public class BehaviorDiodeDispense extends BehaviorDefaultDispenseItem {
FakePlayer fake = FakePlayerFactory.get((WorldServer) source.getWorld(), Profiles.BWMDISP);
fake.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, stack);
DirUtils.setEntityOrientationFacing(fake, facing);
if (BWConfig.debug)
if (GlobalConfig.debug)
BWMod.logger.debug("Better With Mods FakePlayer ID: " + fake.getUniqueID());
if (stack.getItem().onItemUse(fake, source.getWorld(), check, EnumHand.MAIN_HAND, facing, 0.1F, 0.0F, 0.1F) == EnumActionResult.SUCCESS) {
stack.shrink(1);
......
......@@ -3,7 +3,7 @@ package betterwithmods.common.blocks;
import betterwithmods.common.BWMItems;
import betterwithmods.api.block.IMechanicalBlock;
import betterwithmods.api.block.IMultiVariants;
import betterwithmods.config.BWConfig;
import betterwithmods.module.gameplay.Gameplay;
import betterwithmods.util.InvUtils;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
......@@ -68,9 +68,9 @@ public class BlockCrank extends BWMBlock implements IMechanicalBlock, IMultiVari
int meta = state.getValue(STAGE);
if (meta == 0) {
if (BWConfig.crankExhaustion > 0.0F) {
if (Gameplay.crankExhaustion > 0.0) {
if (player.getFoodStats().getFoodLevel() > 6) {
player.addExhaustion(BWConfig.crankExhaustion);
player.addExhaustion((float) Gameplay.crankExhaustion);
if (!world.isRemote) {
toggleSwitch(world, pos, state);
}
......
package betterwithmods.common.blocks;
import betterwithmods.common.BWMBlocks;
import betterwithmods.config.BWConfig;
import betterwithmods.util.DirUtils;
import net.minecraft.block.Block;
import net.minecraft.block.material.EnumPushReaction;
......@@ -24,7 +23,7 @@ import java.util.Random;
public class BlockLens extends BWMBlock {
public static final PropertyBool LIT = PropertyBool.create("lit");
public static final int RANGE = BWConfig.lensRange;
public static final int RANGE = 256;
public BlockLens() {
super(Material.IRON);
......
......@@ -10,7 +10,7 @@ import betterwithmods.common.blocks.tile.TileEntityFilteredHopper;
import betterwithmods.common.blocks.tile.TileEntityMill;
import betterwithmods.common.blocks.tile.TileEntityPulley;
import betterwithmods.common.blocks.tile.TileEntityTurntable;
import betterwithmods.config.BWConfig;
import betterwithmods.module.gameplay.MechanicalBreakage;
import betterwithmods.util.DirUtils;
import betterwithmods.util.InvUtils;
import betterwithmods.util.MechanicalUtil;
......@@ -339,28 +339,28 @@ public class BlockMechMachines extends BWMBlock implements IMechanicalBlock, ITi
}
private void breakMill(World world, BlockPos pos) {
if (BWConfig.dropsMill)
if (MechanicalBreakage.millstone)
InvUtils.ejectBrokenItems(world, pos, new ResourceLocation(BWMod.MODID, "block/mill"));
world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 0.3F, world.rand.nextFloat() * 0.1F + 0.45F);
world.setBlockToAir(pos);
}
private void breakPulley(World world, BlockPos pos) {
if (BWConfig.dropsPulley)
if (MechanicalBreakage.pulley)
InvUtils.ejectBrokenItems(world, pos, new ResourceLocation(BWMod.MODID, "block/pulley"));
world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 0.3F, world.rand.nextFloat() * 0.1F + 0.45F);
world.setBlockToAir(pos);
}
public void breakHopper(World world, BlockPos pos) {
if (BWConfig.dropsHopper)
if (MechanicalBreakage.hopper)
InvUtils.ejectBrokenItems(world, pos, new ResourceLocation(BWMod.MODID, "block/hopper"));
world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 0.3F, world.rand.nextFloat() * 0.1F + 0.45F);
world.setBlockToAir(pos);
}
private void breakTurntable(World world, BlockPos pos) {
if (BWConfig.dropsTurntable)
if (MechanicalBreakage.turntable)
InvUtils.ejectBrokenItems(world, pos, new ResourceLocation(BWMod.MODID, "block/turntable"));
world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 0.3F, world.rand.nextFloat() * 0.1F + 0.45F);
world.setBlockToAir(pos);
......
......@@ -3,10 +3,10 @@ package betterwithmods.common.blocks;
import betterwithmods.common.BWMBlocks;
import betterwithmods.BWMod;
import betterwithmods.api.block.IMechanicalBlock;
import betterwithmods.config.BWConfig;
import betterwithmods.common.registry.SawInteraction;
import betterwithmods.common.damagesource.BWDamageSource;
import betterwithmods.event.MobDropEvent;
import betterwithmods.module.gameplay.MechanicalBreakage;
import betterwithmods.util.DirUtils;
import betterwithmods.util.InvUtils;
import betterwithmods.util.MechanicalUtil;
......@@ -244,7 +244,7 @@ public class BlockSaw extends BWMBlock implements IMechanicalBlock {
}
public void breakSaw(World world, BlockPos pos) {
if (BWConfig.dropsSaw)
if (MechanicalBreakage.saw)
InvUtils.ejectBrokenItems(world, pos, new ResourceLocation(BWMod.MODID, "block/saw"));
/*
InvUtils.ejectStackWithOffset(world, pos, new ItemStack(BWMItems.MATERIAL, 1, 0));
......
......@@ -5,7 +5,7 @@ import betterwithmods.common.BWMItems;
import betterwithmods.api.block.IMultiVariants;
import betterwithmods.client.BWCreativeTabs;
import betterwithmods.common.items.ItemMaterial;
import betterwithmods.util.HardcoreFunctions;
import betterwithmods.module.hardcore.HCStumping;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLog;
import net.minecraft.block.BlockPlanks;
......@@ -77,7 +77,7 @@ public class BlockStump extends Block implements IMultiVariants {
*/
@Nullable
public static IBlockState getStump(IBlockState log) {
BlockPlanks.EnumType variant = HardcoreFunctions.getWoodType(log);
BlockPlanks.EnumType variant = HCStumping.getWoodType(log);
if (variant == null) return null;
return BWMBlocks.STUMP.getDefaultState().withProperty(BlockPlanks.VARIANT, variant);
}
......
......@@ -6,7 +6,7 @@ import betterwithmods.common.blocks.BlockAnchor;
import betterwithmods.common.blocks.BlockMechMachines;
import betterwithmods.common.blocks.BlockRope;
import betterwithmods.common.entity.EntityExtendingRope;
import betterwithmods.config.BWConfig;
import betterwithmods.module.GlobalConfig;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRailBase;
import net.minecraft.block.BlockRailBase.EnumRailDirection;
......@@ -257,7 +257,7 @@ public class TileEntityPulley extends TileEntityVisibleInventory {
}
private boolean addToList(HashSet<BlockPos> set, BlockPos p, boolean up) {
if (set.size() > BWConfig.maxPlatformBlocks)
if (set.size() > GlobalConfig.maxPlatformBlocks)
return false;
BlockPos blockCheck = up ? p.up() : p.down();
......
......@@ -82,6 +82,6 @@ public abstract class TileEntityVisibleInventory extends TileEntityDirectional {
return fill;
}
//Mostly for aesthetic purposes, primarily so the filter in the filtered hopper doesn't count.
//Mostly for aesthetic purposes, primarily so the filter in the filtered hopper doesn't reclaimCount.
public abstract int getMaxVisibleSlots();
}
......@@ -2,7 +2,7 @@ package betterwithmods.common.entity;
import betterwithmods.common.BWMBlocks;
import betterwithmods.common.blocks.tile.TileEntityPulley;
import betterwithmods.config.BWConfig;
import betterwithmods.module.GlobalConfig;
import betterwithmods.util.AABBArray;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
......@@ -110,7 +110,7 @@ public class EntityExtendingRope extends Entity implements IEntityAdditionalSpaw
buf.readBytes(bytes);
compound.setByteArray("BlockData", bytes);
if (BWConfig.dumpBlockData) {
if (GlobalConfig.debug) {
for (int i = 0; i < bytes.length; i++) {
if (i % 16 == 0) {
String text = Integer.toHexString(i);
......@@ -200,7 +200,7 @@ public class EntityExtendingRope extends Entity implements IEntityAdditionalSpaw
}
}
this.setPosition(pulley.getX() + 0.5, this.posY + (up ? BWConfig.upSpeed : -BWConfig.downSpeed),
this.setPosition(pulley.getX() + 0.5, this.posY + (up ? 0.1 : -0.1),
pulley.getZ() + 0.5);
}
......@@ -240,7 +240,7 @@ public class EntityExtendingRope extends Entity implements IEntityAdditionalSpaw
entitiesInBlocks.forEach(e -> e.setPosition(e.posX, Math.max(e.posY, entMaxY.get(e) + newPosY - posY), e.posZ));
entitiesInBlocks.forEach(e -> e.isAirBorne = false);
entitiesInBlocks.forEach(e -> e.onGround = true);
entitiesInBlocks.forEach(e -> e.motionY = Math.max(up ? 0 : -BWConfig.downSpeed, e.motionY));
entitiesInBlocks.forEach(e -> e.motionY = Math.max(up ? 0 : -0.1, e.motionY));
}
......
package betterwithmods.common.items;
import betterwithmods.api.IMultiLocations;
import betterwithmods.config.BWConfig;
import betterwithmods.module.ModuleLoader;
import betterwithmods.module.gameplay.Gameplay;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
......@@ -9,7 +10,7 @@ public abstract class ItemAltName extends Item implements IMultiLocations {
@Override
public String getUnlocalizedName(ItemStack stack) {
if (BWConfig.kidFriendly)
if (Gameplay.kidFriendly)
return super.getUnlocalizedName() + "_kf";
return super.getUnlocalizedName();
}
......
package betterwithmods.common.items;
import betterwithmods.api.IMultiLocations;
import betterwithmods.config.BWConfig;
import betterwithmods.module.ModuleLoader;
import betterwithmods.module.gameplay.Gameplay;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
......@@ -16,7 +17,7 @@ public class ItemAltNameFood extends ItemFood implements IMultiLocations {
@Override
public String[] getLocations() {
if (BWConfig.kidFriendly)
if (Gameplay.kidFriendly)
return new String[]{"creeper_oyster_kf"};
else
return new String[]{"creeper_oyster"};
......@@ -24,7 +25,7 @@ public class ItemAltNameFood extends ItemFood implements IMultiLocations {
@Override
public String getUnlocalizedName(ItemStack stack) {
if (BWConfig.kidFriendly)
if (Gameplay.kidFriendly)
return super.getUnlocalizedName() + "_kf";
return super.getUnlocalizedName();
}
......
package betterwithmods.common.items;
import betterwithmods.client.BWCreativeTabs;
import betterwithmods.config.BWConfig;
import betterwithmods.module.ModuleLoader;
import betterwithmods.module.gameplay.Gameplay;
/**
* Purpose:
......@@ -17,7 +18,7 @@ public class ItemBreedingHarness extends ItemAltName {
@Override
public String[] getLocations() {
if (BWConfig.kidFriendly)
if (Gameplay.kidFriendly)
return new String[]{"breeding_harness_kf"};
else
return new String[]{"breeding_harness"};
......
......@@ -2,7 +2,7 @@ package betterwithmods.common.world;
import betterwithmods.common.BWMBlocks;
import betterwithmods.common.blocks.BlockAesthetic;
import betterwithmods.event.BWMWorldGenEvent;
import betterwithmods.module.hardcore.HCStructures;
import net.minecraft.block.*;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.monster.EntityWitch;
......@@ -80,7 +80,7 @@ public class BWComponentScatteredFeaturePieces extends ComponentScatteredFeature
//Replace Pressure Plate
this.setBlockState(worldIn, Blocks.WOODEN_PRESSURE_PLATE.getDefaultState(), 10, -11, 10, structureBoundingBoxIn);
if (BWMWorldGenEvent.isInRadius(worldIn, worldX, worldZ)) {
if (HCStructures.isInRadius(worldIn, worldX, worldZ)) {
//Dig hole
this.setAir(worldIn, 10, 0, 10, structureBoundingBoxIn);
this.setAir(worldIn, 11, 0, 10, structureBoundingBoxIn);
......@@ -219,7 +219,7 @@ public class BWComponentScatteredFeaturePieces extends ComponentScatteredFeature
this.setAir(worldIn, 6, 3, 10, structureBoundingBoxIn);
this.setAir(worldIn, 5, 3, 10, structureBoundingBoxIn);
if (BWMWorldGenEvent.isInRadius(worldIn, worldX, worldZ)) {
if (HCStructures.isInRadius(worldIn, worldX, worldZ)) {
//Remove hooks
this.setAir(worldIn, 1, -3, 8, structureBoundingBoxIn);
this.setAir(worldIn, 4, -3, 8, structureBoundingBoxIn);
......
This diff is collapsed.
package betterwithmods.config;
import betterwithmods.network.AbstractPacket;
import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import java.util.List;
public class ConfigSyncPacket extends AbstractPacket {
public final List<ConfigCategory> categories = Lists.newLinkedList();
@Override
public IMessage handleClient(NetHandlerPlayClient net) {
ConfigSyncHandler.syncConfig(categories);
return null;
}
@Override
public IMessage handleServer(NetHandlerPlayServer net) {
return null;
}
@Override
public void fromBytes(ByteBuf buf) {
short categoryCount = buf.readShort();
for (short i = 0; i < categoryCount; i++) {
int propCount = buf.readInt();
String categoryName = ByteBufUtils.readUTF8String(buf);
ConfigCategory category = new ConfigCategory(categoryName);
categories.add(category);
for (int j = 0; j < propCount; j++) {
String name = ByteBufUtils.readUTF8String(buf);
char type = buf.readChar();
String value = ByteBufUtils.readUTF8String(buf);
category.put(name, new Property(name, value, Property.Type.tryParse(type)));
}
}
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeShort(categories.size());
for (ConfigCategory category : categories) {
buf.writeInt(category.values().size());
ByteBufUtils.writeUTF8String(buf, category.getName());
for (Property prop : category.values()) {
ByteBufUtils.writeUTF8String(buf, prop.getName());
buf.writeChar(prop.getType().getID());
ByteBufUtils.writeUTF8String(buf, prop.getString()); // always has string representation of the value
}
}
}
}
package betterwithmods.event;
import betterwithmods.config.BWConfig;
import betterwithmods.util.HardcoreFunctions;
import betterwithmods.common.world.BWMapGenScatteredFeature;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.event.terraingen.InitMapGenEvent;
import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent;