Skip to content

Commit

Permalink
Start fix for #33
Browse files Browse the repository at this point in the history
  • Loading branch information
eleksploded committed Jul 15, 2020
1 parent 9d6e6dc commit dd718d0
Show file tree
Hide file tree
Showing 18 changed files with 295 additions and 286 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ Workspace/*
1.12.2/src/.DS_Store
5.5.15/


.DS_Store
2 changes: 1 addition & 1 deletion 1.12.2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ minecraft {
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20171003"
mappings = "stable_39"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ public static class VolcanoSettings {

@Config.Comment("How far in should biome filler blocks go? Set to 0 to disable use of filler blocks")
public int fillerSize = 2;

@Config.Comment("How far down should biome meshing start?")
public int biomeStart = 3;
}

public static class WorldSmeltingOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public static void items(RegistryEvent.Register<Item> event) {
//Register VolcanoBlock Item, cause why not
ItemBlock itemblock = new ItemBlock(VolcanoBlock);
itemblock.setRegistryName(VolcanoBlock.getRegistryName());
itemblock.setUnlocalizedName(VolcanoBlock.getUnlocalizedName());
registry.register(itemblock);
Item item = Item.getItemFromBlock(VolcanoBlock);
proxy.registerItemModels(item, 0, "Inventory");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public static WorldGenerator getGenerator(World world, BlockPos pos) {

public static boolean hasTileEntity(World world, Chunk chunk){
for(BlockPos pos : chunk.getTileEntityMap().keySet()){
if(world.getChunkFromBlockCoords(pos).equals(chunk)){
if(world.getChunk(pos).equals(chunk)){
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class VolcanoBlock extends Block {
public VolcanoBlock() {
super(Material.ROCK);
this.setRegistryName(new ResourceLocation(Reference.MODID, "VolcanoBlock"));
this.setUnlocalizedName(Reference.MODID + ":VolcanoBlock");
//Needed to receive random ticks
this.setTickRandomly(true);
}
Expand All @@ -30,7 +29,7 @@ public void randomTick(World world, BlockPos pos, IBlockState state, Random rand
for(EntityPlayer player : world.playerEntities){
System.out.println(pos.getDistance((int)player.posX, (int)player.posY, (int)player.posZ));
if(pos.getDistance((int)player.posX, (int)player.posY, (int)player.posZ) >= LavaConfig.volcano.minimumDistance) {
Volcano.genVolcano(world.getChunkFromBlockCoords(pos), world);
Volcano.genVolcano(world.getChunk(pos), world);
}
}
}
Expand All @@ -53,7 +52,7 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state,
}

public void forceSpawn(World world, BlockPos pos) {
Volcano.genVolcano(world.getChunkFromBlockCoords(pos), world);
Volcano.genVolcano(world.getChunk(pos), world);
}

public EnumBlockRenderType getRenderType(IBlockState state)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
package com.eleksploded.lavadynamics.arrow;

import com.eleksploded.lavadynamics.LavaDynamics;
import com.eleksploded.lavadynamics.Volcano;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fml.common.FMLCommonHandler;

public class EntityVolcanoArrow extends EntityArrow {

public EntityVolcanoArrow(World world) {
super(world);
}

public EntityVolcanoArrow(World world, EntityLivingBase shooter) {
super(world, shooter);
}

@Override
protected ItemStack getArrowStack() {
// TODO Auto-generated method stub
return null;
}

protected void onHit(RayTraceResult raytraceResultIn)
{
if(shootingEntity == null || !(this.shootingEntity instanceof EntityPlayer)) {
super.onHit(raytraceResultIn);
return;
}

Entity entity = raytraceResultIn.entityHit;
EntityPlayer player = (EntityPlayer) shootingEntity;

if(entity == null) {
if(FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getOppedPlayers().getEntry(player.getGameProfile()) != null) {
BlockPos blockpos = raytraceResultIn.getBlockPos();
world.setBlockState(blockpos, LavaDynamics.VolcanoBlock.getDefaultState());
Chunk chunk = world.getChunkFromBlockCoords(blockpos);
Volcano.genVolcano(chunk, world);
this.setDead();
} else {
super.onHit(raytraceResultIn);
}
} else {
super.onHit(raytraceResultIn);
}
}
package com.eleksploded.lavadynamics.arrow;

import com.eleksploded.lavadynamics.LavaDynamics;
import com.eleksploded.lavadynamics.Volcano;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fml.common.FMLCommonHandler;

public class EntityVolcanoArrow extends EntityArrow {

public EntityVolcanoArrow(World world) {
super(world);
}

public EntityVolcanoArrow(World world, EntityLivingBase shooter) {
super(world, shooter);
}

@Override
protected ItemStack getArrowStack() {
// TODO Auto-generated method stub
return null;
}

protected void onHit(RayTraceResult raytraceResultIn)
{
if(shootingEntity == null || !(this.shootingEntity instanceof EntityPlayer)) {
super.onHit(raytraceResultIn);
return;
}

Entity entity = raytraceResultIn.entityHit;
EntityPlayer player = (EntityPlayer) shootingEntity;

if(entity == null) {
if(FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getOppedPlayers().getEntry(player.getGameProfile()) != null) {
BlockPos blockpos = raytraceResultIn.getBlockPos();
world.setBlockState(blockpos, LavaDynamics.VolcanoBlock.getDefaultState());
Chunk chunk = world.getChunk(blockpos);
Volcano.genVolcano(chunk, world);
this.setDead();
} else {
super.onHit(raytraceResultIn);
}
} else {
super.onHit(raytraceResultIn);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
package com.eleksploded.lavadynamics.arrow;

import com.eleksploded.lavadynamics.Reference;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderArrow;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderVolcanoArrow extends RenderArrow<EntityVolcanoArrow>
{
public static final ResourceLocation texture = new ResourceLocation(Reference.MODID, "textures/volcanoarrow.png");

public RenderVolcanoArrow(RenderManager manager)
{
super(manager);
}

@Override
protected ResourceLocation getEntityTexture(EntityVolcanoArrow entity) {
return texture;
}

public static class VolcanoArrowRenderFactory implements IRenderFactory<EntityVolcanoArrow> {

public static final VolcanoArrowRenderFactory INSTANCE = new VolcanoArrowRenderFactory();

@Override
public Render<? super EntityVolcanoArrow> createRenderFor(RenderManager manager) {
return new RenderVolcanoArrow(manager);
}
}
package com.eleksploded.lavadynamics.arrow;

import com.eleksploded.lavadynamics.Reference;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderArrow;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderVolcanoArrow extends RenderArrow<EntityVolcanoArrow>
{
public static final ResourceLocation texture = new ResourceLocation(Reference.MODID, "textures/volcanoarrow.png");

public RenderVolcanoArrow(RenderManager manager)
{
super(manager);
}

@Override
protected ResourceLocation getEntityTexture(EntityVolcanoArrow entity) {
return texture;
}

public static class VolcanoArrowRenderFactory implements IRenderFactory<EntityVolcanoArrow> {

public static final VolcanoArrowRenderFactory INSTANCE = new VolcanoArrowRenderFactory();

@Override
public Render<? super EntityVolcanoArrow> createRenderFor(RenderManager manager) {
return new RenderVolcanoArrow(manager);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
package com.eleksploded.lavadynamics.arrow;

import com.eleksploded.lavadynamics.Reference;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.ItemArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class VolcanoArrow extends ItemArrow {

public VolcanoArrow() {
this.setRegistryName(Reference.MODID, "VolcanoArrow");
this.setUnlocalizedName(this.getRegistryName().toString());
this.setCreativeTab(CreativeTabs.MISC);
}

public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter)
{
EntityVolcanoArrow arrow = new EntityVolcanoArrow(worldIn, shooter);
return arrow;
}
}
package com.eleksploded.lavadynamics.arrow;

import com.eleksploded.lavadynamics.Reference;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.item.ItemArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class VolcanoArrow extends ItemArrow {

public VolcanoArrow() {
this.setRegistryName(Reference.MODID, "VolcanoArrow");
this.setCreativeTab(CreativeTabs.MISC);
}

public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter)
{
EntityVolcanoArrow arrow = new EntityVolcanoArrow(worldIn, shooter);
return arrow;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
}

try{
StorageManager.getCheckedStorage(sender.getEntityWorld().provider.getDimension()).addChecked(sender.getEntityWorld().getChunkFromChunkCoords(Integer.valueOf(args[0]), Integer.valueOf(args[1])));
StorageManager.getCheckedStorage(sender.getEntityWorld().provider.getDimension()).addChecked(sender.getEntityWorld().getChunk(Integer.valueOf(args[0]), Integer.valueOf(args[1])));
sender.sendMessage(new TextComponentString("Added chunk [" + Integer.valueOf(args[0]) + "," + Integer.valueOf(args[1]) + "]"));
} catch(NumberFormatException e){
throw new WrongUsageException(getUsage(sender), new Object[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public String getUsage(ICommandSender sender) {

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
Chunk chunk = sender.getEntityWorld().getChunkFromBlockCoords(sender.getPosition());
Chunk chunk = sender.getEntityWorld().getChunk(sender.getPosition());
if(StorageManager.getCheckedStorage(sender.getEntityWorld().provider.getDimension()).isChecked(chunk)){
sender.sendMessage(new TextComponentString("Chunk [" + chunk.x + "," + chunk.z + "] has been checked"));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public String getUsage(ICommandSender sender) {

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
Chunk chunk = sender.getEntityWorld().getChunkFromBlockCoords(sender.getPosition());
Chunk chunk = sender.getEntityWorld().getChunk(sender.getPosition());

if(!StorageManager.getVolcanoStorage(sender.getEntityWorld().provider.getDimension()).isVolcano(chunk)){
sender.sendMessage(new TextComponentString("Chunk does not contain a volcano. Please run this in a chunk that contains a volcamo."));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public String getUsage(ICommandSender sender) {

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
Chunk chunk = sender.getEntityWorld().getChunkFromBlockCoords(sender.getPosition());
Chunk chunk = sender.getEntityWorld().getChunk(sender.getPosition());
boolean bypass;
if(args.length == 1){
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ public void circle(int radius, World world, BlockPos fill1, int j) {

for(float i1 = 0; i1 < radius; i1 += 0.5) {
for(float j1 = 0; j1 < 2 * Math.PI * i1; j1 += 0.5) {
if(LavaConfig.volcano.useBiome && i1 == radius-.5) {
setBlockWithBiomeTop(world,new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1, (int)Math.floor(z1 + Math.cos(j1) * i1)));
if(LavaConfig.volcano.useBiome && i1 == radius-.5 && radius > LavaConfig.volcano.biomeStart) {
if(radius == LavaConfig.volcano.biomeStart && world.rand.nextBoolean()) {
setBlockWithOre(world,new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1, (int)Math.floor(z1 + Math.cos(j1) * i1)), false);
} else {
setBlockWithBiomeTop(world,new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1, (int)Math.floor(z1 + Math.cos(j1) * i1)));
}
} else {
setBlockWithOre(world,new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1, (int)Math.floor(z1 + Math.cos(j1) * i1)), LavaConfig.volcano.useBiome && i1 >= (radius-((LavaConfig.volcano.fillerSize) + .5F)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
import java.util.Random;

import com.eleksploded.lavadynamics.LavaConfig;
import com.eleksploded.lavadynamics.Reference;
import com.eleksploded.lavadynamics.storage.StorageManager;
import com.eleksploded.lavadynamics.storage.VolcanoStorage;

import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent;
import net.minecraftforge.fml.relauncher.Side;

@Mod.EventBusSubscriber
@Mod.EventBusSubscriber(modid = Reference.MODID, value = Side.SERVER)
public class RunEffects {
static int timer = 0;

Expand All @@ -29,8 +31,9 @@ public static void load(WorldTickEvent event){
if(rand.nextInt(999)+1 <= LavaConfig.postgen.chance){
VolcanoStorage storage = StorageManager.getVolcanoStorage(event.world.provider.getDimension());
if(storage != null){
if(storage.getList().size() != 0){
Chunk chunk = storage.getList().get(rand.nextInt(storage.getList().size()));
int num = storage.getNum();
if(num != 0){
Chunk chunk = storage.get(rand.nextInt(num)+1, event.world);
PostGenEffectRegistry.runEffect(chunk, storage.getTop(chunk));
timer = (int)Math.floor(LavaConfig.postgen.effectTime * 1200);
}
Expand Down
Loading

0 comments on commit dd718d0

Please sign in to comment.