Commit eaf76b1b authored by Bailey's avatar Bailey 🚟

Added new menu panorama option to enable a sky dimension panorama (disabled by...

Added new menu panorama option to enable a sky dimension panorama (disabled by default), Added new config option to enable cows and pigs in the sky dimension for more atmosphere
parent dfe22797
......@@ -12,7 +12,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.1.2'
version = '1.2.0'
group = 'com.legacy.rediscovered'
archivesBaseName = 'rediscovered-1.14.4'
......@@ -20,6 +20,7 @@ sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = co
minecraft {
mappings channel: 'snapshot', version: '20200119-1.14.3'
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
......
......@@ -16,6 +16,7 @@ public class RediscoveredConfig
public static final ServerConfig SERVER;
public static boolean stevesAnimated;
public static boolean skyPanorama;
public static boolean daytimeDreamPillow;
public static boolean tameableRedDragon;
......@@ -28,6 +29,7 @@ public class RediscoveredConfig
public static boolean pigmenNeutral;
public static boolean disableBedTeleportation;
public static boolean disableGiantAppleDrops;
public static boolean cowsAndPigsInSky;
static
{
......@@ -66,11 +68,13 @@ public class RediscoveredConfig
private static class ClientConfig
{
public final ForgeConfigSpec.ConfigValue<Boolean> stevesAnimated;
public final ForgeConfigSpec.ConfigValue<Boolean> skyPanorama;
public ClientConfig(ForgeConfigSpec.Builder builder)
{
builder.comment("Client side changes.").push("client");
stevesAnimated = builder.translation(translate("stevesAnimated")).comment("Allows Steve mobs to be animated.").define("stevesAnimated", true);
skyPanorama = builder.translation(translate("skyPanorama")).comment("Enables a custom panorama of the Sky Dimension on the main menu. (This can cause incompatibilities when enabled with other menu mods, enable at your own risk.)").define("skyPanorama", false);
builder.pop();
}
}
......@@ -88,6 +92,7 @@ public class RediscoveredConfig
public final ForgeConfigSpec.ConfigValue<Boolean> pigmenNeutral;
public final ForgeConfigSpec.ConfigValue<Boolean> disableBedTeleportation;
public final ForgeConfigSpec.ConfigValue<Boolean> disableGiantAppleDrops;
public final ForgeConfigSpec.ConfigValue<Boolean> cowsAndPigsInSky;
public ServerConfig(ForgeConfigSpec.Builder builder)
{
......@@ -103,6 +108,7 @@ public class RediscoveredConfig
pigmenNeutral = builder.translation(translate("pigmenNeutral")).comment("Makes Pigman guards neutral, instead of hostile.").define("pigmenNeutral", false);
disableBedTeleportation = builder.translation(translate("disableBedTeleportation")).comment("Disables randomly teleporting to the Sky Dimension when sleeping.").define("disableBedTeleportation", false);
disableGiantAppleDrops = builder.translation(translate("disableGiantAppleDrops")).comment("Disables Giants dropping Golden Apples.").define("disableGiantAppleDrops", false);
cowsAndPigsInSky = builder.translation(translate("cowsAndPigsInSky")).comment("Allows pigs and cows to spawn in the sky dimension, this is not how it used to be originally, but it's here for a bit more atmosphere.").define("cowsAndPigsInSky", false);
builder.pop();
}
......@@ -118,6 +124,7 @@ public class RediscoveredConfig
{
clientConfig = config;
stevesAnimated = CLIENT.stevesAnimated.get();
skyPanorama = CLIENT.skyPanorama.get();
}
public static void bakeServer(ModConfig config)
......@@ -134,6 +141,7 @@ public class RediscoveredConfig
pigmenNeutral = SERVER.pigmenNeutral.get();
disableBedTeleportation = SERVER.disableBedTeleportation.get();
disableGiantAppleDrops = SERVER.disableGiantAppleDrops.get();
cowsAndPigsInSky = SERVER.cowsAndPigsInSky.get();
}
}
}
package com.legacy.rediscovered;
import com.legacy.rediscovered.block.RediscoveredBlocks;
import com.legacy.rediscovered.client.RediscoveredClientEvents;
import com.legacy.rediscovered.client.RediscoveredEntityRendering;
import com.legacy.rediscovered.entity.RediscoveredEntityTypes;
import com.legacy.rediscovered.event.RediscoveredEvents;
......@@ -72,5 +73,6 @@ public class RediscoveredMod
public void clientInit(FMLClientSetupEvent event)
{
RediscoveredEntityRendering.init();
MinecraftForge.EVENT_BUS.register(new RediscoveredClientEvents());
}
}
package com.legacy.rediscovered.block;
import java.util.List;
import com.legacy.rediscovered.entity.util.MountableBlockEntity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.IWaterLoggable;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.BlockItemUseContext;
......@@ -13,12 +18,16 @@ import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
......@@ -38,6 +47,36 @@ public class ChairBlock extends HorizontalBlock implements IWaterLoggable
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH).with(WATERLOGGED, false));
}
@Override
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit)
{
if (!worldIn.isRemote)
{
List<MountableBlockEntity> listEMB = worldIn.getEntitiesWithinAABB(MountableBlockEntity.class, new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1.0D, pos.getY() + 1.0D, pos.getZ() + 1.0D).expand(1D, 1D, 1D));
for (MountableBlockEntity entitytocheck : listEMB)
{
if (entitytocheck.orgBlockPosX == pos.getX() && entitytocheck.orgBlockPosY == pos.getY() && entitytocheck.orgBlockPosZ == pos.getZ())
{
entitytocheck.interact(player);
return true;
}
}
float mountingX = pos.getX() + 0.5F;
float mountingY = pos.getY();
float mountingZ = pos.getZ() + 0.5F;
MountableBlockEntity nemb = new MountableBlockEntity(worldIn, player, pos.getX(), pos.getY(), pos.getZ(), mountingX, mountingY, mountingZ);
worldIn.addEntity(nemb);
nemb.interact(player);
return true;
}
else
{
return true;
}
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
{
......
package com.legacy.rediscovered.client;
import com.legacy.rediscovered.RediscoveredConfig;
import com.legacy.rediscovered.RediscoveredMod;
import net.minecraft.client.gui.screen.MainMenuScreen;
import net.minecraft.client.renderer.RenderSkyboxCube;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
public class RediscoveredClientEvents
{
public static RenderSkyboxCube PANORAMA_RESOURCES = new RenderSkyboxCube(RediscoveredMod.locate("textures/gui/panorama/panorama"));
@SubscribeEvent
public void onOpenGui(GuiOpenEvent event)
{
if (event.getGui() instanceof MainMenuScreen && RediscoveredConfig.skyPanorama)
{
MainMenuScreen.PANORAMA_RESOURCES = PANORAMA_RESOURCES;
event.setGui(new MainMenuScreen());
}
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.legacy.rediscovered.client.render.entity.BeastBoyRenderer;
import com.legacy.rediscovered.client.render.entity.BlackSteveRenderer;
import com.legacy.rediscovered.client.render.entity.FishRenderer;
import com.legacy.rediscovered.client.render.entity.MeleePigmanRenderer;
import com.legacy.rediscovered.client.render.entity.MountableBlockRenderer;
import com.legacy.rediscovered.client.render.entity.PigmanRenderer;
import com.legacy.rediscovered.client.render.entity.PurpleArrowRenderer;
import com.legacy.rediscovered.client.render.entity.RanaRenderer;
......@@ -22,6 +23,7 @@ import com.legacy.rediscovered.entity.SteveEntity;
import com.legacy.rediscovered.entity.pigman.MeleePigmanEntity;
import com.legacy.rediscovered.entity.pigman.PigmanEntity;
import com.legacy.rediscovered.entity.pigman.RangedPigmanEntity;
import com.legacy.rediscovered.entity.util.MountableBlockEntity;
import net.minecraft.entity.Entity;
import net.minecraftforge.fml.client.registry.IRenderFactory;
......@@ -43,8 +45,8 @@ public class RediscoveredEntityRendering
register(RedDragonEntity.class, RedDragonRenderer::new);
register(ScarecrowEntity.class, ScarecrowRenderer::new);
register(PurpleArrowEntity.class, PurpleArrowRenderer::new);
register(MountableBlockEntity.class, MountableBlockRenderer::new);
}
private static <T extends Entity> void register(Class<T> entityClass, IRenderFactory<? super T> renderFactory)
......
package com.legacy.rediscovered.client.render.entity;
import com.legacy.rediscovered.entity.util.MountableBlockEntity;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.util.ResourceLocation;
public class MountableBlockRenderer extends EntityRenderer<MountableBlockEntity>
{
public MountableBlockRenderer(EntityRendererManager renderer)
{
super(renderer);
}
@Override
public void doRender(MountableBlockEntity par1EntityLiving, double d, double d1, double d2, float f, float f1)
{
}
@Override
protected ResourceLocation getEntityTexture(MountableBlockEntity entity)
{
return new ResourceLocation("textures/entity/pig/pig.png");
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import com.legacy.rediscovered.RediscoveredRegistry;
import com.legacy.rediscovered.entity.pigman.MeleePigmanEntity;
import com.legacy.rediscovered.entity.pigman.PigmanEntity;
import com.legacy.rediscovered.entity.pigman.RangedPigmanEntity;
import com.legacy.rediscovered.entity.util.MountableBlockEntity;
import com.legacy.rediscovered.entity.util.SpawnerEntity;
import com.legacy.rediscovered.world.dimension.RediscoveredDimensions;
......@@ -42,6 +43,7 @@ public class RediscoveredEntityTypes
public static final EntityType<ScarecrowEntity> SCARECROW = buildEntity("scarecrow", EntityType.Builder.<ScarecrowEntity>create(ScarecrowEntity::new, EntityClassification.MISC).size(0.3F, 1.975F));
public static final EntityType<SpawnerEntity> VANILLA_SPAWNER = buildEntity("spawner", EntityType.Builder.create(SpawnerEntity::new, EntityClassification.CREATURE).size(1.0F, 2.0F));
public static final EntityType<PurpleArrowEntity> PURPLE_ARROW = buildEntity("purple_arrow", EntityType.Builder.<PurpleArrowEntity>create(PurpleArrowEntity::new, EntityClassification.MISC).setCustomClientFactory(PurpleArrowEntity::new).setShouldReceiveVelocityUpdates(true).size(0.5F, 0.5F));
public static final EntityType<MountableBlockEntity> MOUNTABLE_BLOCK = buildEntity("mountable_block", EntityType.Builder.<MountableBlockEntity>create(MountableBlockEntity::new, EntityClassification.MISC).setCustomClientFactory(MountableBlockEntity::new).size(1.0F, 1.0F));
public static void init(Register<EntityType<?>> event)
{
......@@ -60,6 +62,7 @@ public class RediscoveredEntityTypes
RediscoveredRegistry.register(event.getRegistry(), "scarecrow", SCARECROW);
RediscoveredRegistry.register(event.getRegistry(), "spawner", VANILLA_SPAWNER);
RediscoveredRegistry.register(event.getRegistry(), "purple_arrow", PURPLE_ARROW);
RediscoveredRegistry.register(event.getRegistry(), "mountable_block", MOUNTABLE_BLOCK);
registerSpawnConditions();
}
......
package com.legacy.rediscovered.entity.util;
import com.legacy.rediscovered.entity.RediscoveredEntityTypes;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.FMLPlayMessages;
import net.minecraftforge.fml.network.NetworkHooks;
public class MountableBlockEntity extends Entity
{
public int orgBlockPosX;
public int orgBlockPosY;
public int orgBlockPosZ;
public BlockState orgBlockID;
public float blahx, blahy, blahz;
public MountableBlockEntity(EntityType<? extends MountableBlockEntity> type, World world)
{
super(type, world);
noClip = true;
preventEntitySpawning = true;
}
public MountableBlockEntity(World world, double d, double d1, double d2)
{
super(RediscoveredEntityTypes.MOUNTABLE_BLOCK, world);
noClip = true;
preventEntitySpawning = true;
setPosition(d, d1, d2);
}
public MountableBlockEntity(World world, PlayerEntity PlayerEntity, int i, int j, int k, float mountingX, float mountingY, float mountingZ)
{
super(RediscoveredEntityTypes.MOUNTABLE_BLOCK, world);
noClip = true;
preventEntitySpawning = true;
orgBlockPosX = i;
orgBlockPosY = j;
orgBlockPosZ = k;
orgBlockID = world.getBlockState(new BlockPos(i, j, k));
blahx = mountingX;
blahy = mountingY;
blahz = mountingZ;
setPosition(mountingX, mountingY, mountingZ);
}
public MountableBlockEntity(FMLPlayMessages.SpawnEntity spawnEntity, World world)
{
this(RediscoveredEntityTypes.MOUNTABLE_BLOCK, world);
}
public boolean interact(PlayerEntity PlayerEntity)
{
if (this.getRidingEntity() != null && this.getRidingEntity() instanceof PlayerEntity && this.getRidingEntity() != PlayerEntity)
{
return true;
}
else
{
if (!this.world.isRemote)
{
PlayerEntity.startRiding(this);
}
return true;
}
}
@SuppressWarnings("deprecation")
@Override
public void tick()
{
super.tick();
if (this.getPassengers().isEmpty() || !this.getPassengers().isEmpty() && !this.getPassengers().get(0).isAlive() || this.ticksExisted > 20 && this.world.getBlockState(this.getPosition().up()).isAir())
{
this.remove();
}
if ((this.posY == Math.floor(this.posY)) && !Double.isInfinite(this.posY))
{
this.posY -= 0.5F;
}
}
@Override
public boolean canBePushed()
{
return false;
}
@Override
public void registerData()
{
}
@Override
public void readAdditional(CompoundNBT nbttagcompound)
{
}
@Override
public void writeAdditional(CompoundNBT nbttagcompound)
{
}
@Override
public IPacket<?> createSpawnPacket()
{
return NetworkHooks.getEntitySpawningPacket(this);
}
}
\ No newline at end of file
package com.legacy.rediscovered.world.biome;
import com.legacy.rediscovered.RediscoveredConfig;
import com.legacy.rediscovered.block.RediscoveredBlocks;
import com.legacy.rediscovered.entity.RediscoveredEntityTypes;
import com.legacy.rediscovered.world.biome.feature.IceAndSnowSkyFeature;
......@@ -47,9 +48,13 @@ public final class SkylandsBiome extends Biome
DefaultBiomeFeatures.addOres(this);
this.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, RediscoveredBlocks.ruby_ore.getDefaultState(), 4), Placement.COUNT_RANGE, new CountRangeConfig(2, 0, 0, 32)));
if (RediscoveredConfig.cowsAndPigsInSky)
{
this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.COW, 110, 2, 4));
this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.PIG, 130, 2, 4));
}
this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.CHICKEN, 150, 2, 4));
this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.COW, 110, 2, 4));
this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.PIG, 130, 2, 4));
this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(RediscoveredEntityTypes.VANILLA_SPAWNER, 1, 1, 1)); // Giant
this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(RediscoveredEntityTypes.RED_DRAGON, 15, 1, 1));
......
......@@ -122,11 +122,8 @@ public class SmallPigmanVillagePieces
}
else if ("nitwit".equals(function))
{
System.out.println("a");
if (rand.nextBoolean() && worldIn.getDifficulty() != Difficulty.PEACEFUL)
{
System.out.println("ill");
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 3);
IllusionerEntity entity = EntityType.ILLUSIONER.create(worldIn.getWorld());
entity.enablePersistence();
......
public-f net.minecraft.client.gui.screen.MainMenuScreen field_213098_a #PANORAMA_RESOURCES
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment