Skip to content

Commit

Permalink
Merge pull request #5 from KiriCattus/master
Browse files Browse the repository at this point in the history
Large refactor and cleanup of code for 1.12.2.
  • Loading branch information
KiriCattus authored Nov 26, 2021
2 parents 384ce7a + 8dddc80 commit e0ad59b
Show file tree
Hide file tree
Showing 75 changed files with 6,230 additions and 7,079 deletions.
18 changes: 1 addition & 17 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,5 @@ build
eclipse
run

CREDITS-fml.txt
Paulscode SoundSystem CodecIBXM License.txt
LICENSE-new.txt
forge-1.10.2-12.18.3.2221-changelog.txt
Paulscode IBXM Library License.txt
MinecraftForge-Credits.txt
.gradle.zip
shoots.png
dates.1.png
dates.0.png
palm.png
palette.png
dates.2.png
forge-1.10.2-12.18.3.2281-changelog.txt
README.txt
src/main/resources/mcmod.info
secret.json
secret.txt
secret.txt
File renamed without changes.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ if (secretFile.exists()) {
}

minecraft {
version = "1.12-14.21.1.2443"
version = "1.12.2-14.23.5.2836"
runDir = "run"
mappings = "snapshot_20180709"
mappings = "stable_39"
// makeObfSourceJar = false
}

Expand Down
93 changes: 44 additions & 49 deletions src/main/java/panda/gotwood/GotWood.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,70 +9,65 @@
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;

import panda.gotwood.block.entity.TileEntityTreeTap;
import panda.gotwood.events.ConfigurationHandler;
import panda.gotwood.generation.WorldGenerator;
import panda.gotwood.proxy.CommonProxy;
import panda.gotwood.registry.BlockRegistry;
import panda.gotwood.registry.ItemRegistry;
import panda.gotwood.registry.MasterRegistrar;

@Mod(modid = GotWood.MODID, name = GotWood.NAME, version = GotWood.VERSION)

public class GotWood
{
public static final String MODID = "gotwood";
public static final String ID = MODID; // lots of use of "GotWood.ID" still in the code-base, Panda
public static final String VERSION = "0.26.0";

public static final String NAME = "Got Wood?";
@Mod(
modid = GotWood.MODID,
name = GotWood.NAME,
version = GotWood.VERSION)
public class GotWood {

@SidedProxy(clientSide = "panda.gotwood.proxy.ClientProxy", serverSide = "panda.gotwood.proxy.ServerProxy")
public static CommonProxy proxy;
//TODO Setup new gradle scripts and mod info -ProxyNeko
public static final String MODID = "gotwood";
public static final String VERSION = "0.26.0";
public static final String NAME = "Got Wood?";

@SubscribeEvent
public void registerSpecialRecipes(RegistryEvent.Register<IRecipe> event) {
if (ConfigurationHandler.retrieveSaplingsMode == 2) {
ResourceLocation group = new ResourceLocation(GotWood.ID);
GameRegistry.addShapelessRecipe(new ResourceLocation("oak_seed"), group, new ItemStack(Blocks.SAPLING, 1, 0), Ingredient.fromStacks(new ItemStack(ItemRegistry.oak_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("spruce_seed"), group, new ItemStack(Blocks.SAPLING, 1, 1), Ingredient.fromStacks(new ItemStack(ItemRegistry.spruce_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("birch_seed"), group, new ItemStack(Blocks.SAPLING, 1, 2), Ingredient.fromStacks(new ItemStack(ItemRegistry.birch_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("jungle_seed"), group, new ItemStack(Blocks.SAPLING, 1, 3), Ingredient.fromStacks(new ItemStack(ItemRegistry.jungle_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("acacia_seed"), group, new ItemStack(Blocks.SAPLING, 1, 4), Ingredient.fromStacks(new ItemStack(ItemRegistry.acacia_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("dark_oak_seed"), group, new ItemStack(Blocks.SAPLING, 1, 5), Ingredient.fromStacks(new ItemStack(ItemRegistry.dark_oak_seed)));
public static final CreativeTabs TREE_TAB = new CreativeTabs(GotWood.MODID) {
@Override
public ItemStack createIcon() {
return new ItemStack(ItemRegistry.oak_seed);
}
};

GameRegistry.addShapelessRecipe(new ResourceLocation("apple_seed"), group, new ItemStack(BlockRegistry.apple_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.apple_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("maple_seed"), group, new ItemStack(BlockRegistry.maple_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.maple_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("pine_seed"), group, new ItemStack(BlockRegistry.pine_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.pine_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("willow_seed"), group, new ItemStack(BlockRegistry.willow_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.willow_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("yew_seed"), group, new ItemStack(BlockRegistry.yew_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.yew_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("ebony_seed"), group, new ItemStack(BlockRegistry.ebony_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.ebony_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("fir_seed"), group, new ItemStack(BlockRegistry.fir_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.fir_seed)));
}
}
@SubscribeEvent
public void registerSpecialRecipes(RegistryEvent.Register<IRecipe> event) {
if (ConfigurationHandler.retrieveSaplingsMode == 2) {
ResourceLocation group = new ResourceLocation(GotWood.MODID);
GameRegistry.addShapelessRecipe(new ResourceLocation("oak_seed"), group, new ItemStack(Blocks.SAPLING, 1, 0), Ingredient.fromStacks(new ItemStack(ItemRegistry.oak_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("spruce_seed"), group, new ItemStack(Blocks.SAPLING, 1, 1), Ingredient.fromStacks(new ItemStack(ItemRegistry.spruce_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("birch_seed"), group, new ItemStack(Blocks.SAPLING, 1, 2), Ingredient.fromStacks(new ItemStack(ItemRegistry.birch_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("jungle_seed"), group, new ItemStack(Blocks.SAPLING, 1, 3), Ingredient.fromStacks(new ItemStack(ItemRegistry.jungle_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("acacia_seed"), group, new ItemStack(Blocks.SAPLING, 1, 4), Ingredient.fromStacks(new ItemStack(ItemRegistry.acacia_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("dark_oak_seed"), group, new ItemStack(Blocks.SAPLING, 1, 5), Ingredient.fromStacks(new ItemStack(ItemRegistry.dark_oak_seed)));

@EventHandler
public void preinit(FMLPreInitializationEvent event) {
MasterRegistrar.callRegistry(event);
}
GameRegistry.addShapelessRecipe(new ResourceLocation("apple_seed"), group, new ItemStack(BlockRegistry.apple_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.apple_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("maple_seed"), group, new ItemStack(BlockRegistry.maple_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.maple_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("pine_seed"), group, new ItemStack(BlockRegistry.pine_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.pine_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("willow_seed"), group, new ItemStack(BlockRegistry.willow_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.willow_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("yew_seed"), group, new ItemStack(BlockRegistry.yew_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.yew_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("ebony_seed"), group, new ItemStack(BlockRegistry.ebony_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.ebony_seed)));
GameRegistry.addShapelessRecipe(new ResourceLocation("fir_seed"), group, new ItemStack(BlockRegistry.fir_sapling), Ingredient.fromStacks(new ItemStack(ItemRegistry.fir_seed)));
}
}

@EventHandler
public void init(FMLInitializationEvent event) {
GameRegistry.registerWorldGenerator(new WorldGenerator(), 0);
BlockRegistry.specialfire.initInfo();
GameRegistry.registerTileEntity(TileEntityTreeTap.class, "gotwood:tree_tap");
}
@EventHandler
public void preinit(FMLPreInitializationEvent event) {
MasterRegistrar.callRegistry(event);
}

public static final CreativeTabs TREE_TAB = new CreativeTabs(GotWood.ID) {
@Override
public ItemStack getTabIconItem() {
return new ItemStack(ItemRegistry.oak_seed);
}
};
@EventHandler
public void init(FMLInitializationEvent event) {
GameRegistry.registerWorldGenerator(new WorldGenerator(), 0);
BlockRegistry.specialfire.initInfo();
GameRegistry.registerTileEntity(TileEntityTreeTap.class, "gotwood:tree_tap");
}
}
200 changes: 98 additions & 102 deletions src/main/java/panda/gotwood/block/BlockBambooFence.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package panda.gotwood.block;

import java.util.List;
import javax.annotation.Nullable;

import net.minecraft.block.BlockFence;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.SoundType;
Expand All @@ -15,107 +12,106 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import panda.gotwood.util.IOreDictionaryEntry;
import panda.gotwood.util.WoodMaterial;

import javax.annotation.Nullable;
import java.util.List;

public final class BlockBambooFence extends BlockFence implements IOreDictionaryEntry {
private final WoodMaterial wood;

private static final AxisAlignedBB[] BOUNDING_BOXES = new AxisAlignedBB[] {
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)
};

public static final AxisAlignedBB PILLAR_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.5D, 0.625D);

public static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.625D, 0.625D, 1.5D, 1.0D);

public static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.375D, 1.5D, 0.625D);

public static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.5D, 0.375D);

public static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.625D, 0.0D, 0.375D, 1.0D, 1.5D, 0.625D);

public BlockBambooFence(WoodMaterial wood) {
super(Material.WOOD, BlockPlanks.EnumType.OAK.getMapColor());
this.setSoundType(SoundType.WOOD);
this.wood = wood;
this.blockHardness = wood.getPlankBlockHardness();
this.blockResistance = wood.getBlastResistance();
this.setHarvestLevel("axe", wood.getRequiredHarvestLevel());
Blocks.FIRE.setFireInfo(this, 5, 20);
this.setRegistryName(wood.getName() + "_fence");
}

public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
IBlockState actualstate = state.getActualState(worldIn, pos);
addCollisionBoxToList(pos, entityBox, collidingBoxes, PILLAR_AABB);

if (actualstate.getValue(NORTH)) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, NORTH_AABB);
}

if (actualstate.getValue(EAST)) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
}

if (actualstate.getValue(SOUTH)) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, SOUTH_AABB);
}

if (actualstate.getValue(WEST)) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
}
}

@Deprecated
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return BOUNDING_BOXES[getBoundingBoxIdx(this.getActualState(state, source, pos))];
}

private static int getBoundingBoxIdx(IBlockState state) {
int i = 0;

if (state.getValue(NORTH)) {
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
}

if (state.getValue(EAST)) {
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
}

if (state.getValue(SOUTH)) {
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
}

if (state.getValue(WEST)) {
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
}

return i;
}

public WoodMaterial getWoodMaterial() {
return this.wood;
}

@Override
public String getOreDictionaryName() {
return "fence" + this.wood.getCapitalizedName();
}

private final WoodMaterial wood;

private static final AxisAlignedBB[] BOUNDING_BOXES = new AxisAlignedBB[]{
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D),
new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)
};

public static final AxisAlignedBB PILLAR_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.5D, 0.625D);
public static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.625D, 0.625D, 1.5D, 1.0D);
public static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 0.375D, 1.5D, 0.625D);
public static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.5D, 0.375D);
public static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.625D, 0.0D, 0.375D, 1.0D, 1.5D, 0.625D);

public BlockBambooFence(WoodMaterial wood) {
super(Material.WOOD, BlockPlanks.EnumType.OAK.getMapColor());
this.setSoundType(SoundType.WOOD);
this.wood = wood;
this.blockHardness = wood.getPlankBlockHardness();
this.blockResistance = wood.getBlastResistance();
this.setHarvestLevel("axe", wood.getRequiredHarvestLevel());
Blocks.FIRE.setFireInfo(this, 5, 20);
this.setRegistryName(wood.getName() + "_fence");
}

public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) {
IBlockState actualstate = state.getActualState(worldIn, pos);
addCollisionBoxToList(pos, entityBox, collidingBoxes, PILLAR_AABB);

if (actualstate.getValue(NORTH)) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, NORTH_AABB);
}

if (actualstate.getValue(EAST)) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
}

if (actualstate.getValue(SOUTH)) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, SOUTH_AABB);
}

if (actualstate.getValue(WEST)) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
}
}

@Deprecated
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return BOUNDING_BOXES[getBoundingBoxIdx(this.getActualState(state, source, pos))];
}

private static int getBoundingBoxIdx(IBlockState state) {
int i = 0;

if (state.getValue(NORTH)) {
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
}

if (state.getValue(EAST)) {
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
}

if (state.getValue(SOUTH)) {
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
}

if (state.getValue(WEST)) {
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
}

return i;
}

public WoodMaterial getWoodMaterial() {
return this.wood;
}

@Override
public String getOreDictionaryName() {
return "fence" + this.wood.getCapitalizedName();
}
}
Loading

0 comments on commit e0ad59b

Please sign in to comment.