mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 06:11:24 +00:00
MaterialData is gone
This commit is contained in:
@@ -6,7 +6,6 @@ import com.dfsek.terra.api.addons.TerraAddon;
|
||||
import com.dfsek.terra.api.event.EventManager;
|
||||
import com.dfsek.terra.api.event.TerraEventManager;
|
||||
import com.dfsek.terra.api.platform.block.BlockData;
|
||||
import com.dfsek.terra.api.platform.block.MaterialData;
|
||||
import com.dfsek.terra.api.platform.handle.ItemHandle;
|
||||
import com.dfsek.terra.api.platform.handle.WorldHandle;
|
||||
import com.dfsek.terra.api.platform.world.World;
|
||||
@@ -216,7 +215,6 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
genericLoaders.register(registry);
|
||||
registry
|
||||
.registerLoader(BlockData.class, (t, o, l) -> worldHandle.createBlockData((String) o))
|
||||
.registerLoader(MaterialData.class, (t, o, l) -> worldHandle.createMaterialData((String) o))
|
||||
.registerLoader(com.dfsek.terra.api.platform.world.Biome.class, (t, o, l) -> new FabricBiome(biomeFixer.translate((String) o)));
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,16 +1,16 @@
|
||||
package com.dfsek.terra.fabric.inventory;
|
||||
|
||||
import com.dfsek.terra.api.platform.block.MaterialData;
|
||||
import com.dfsek.terra.api.platform.handle.ItemHandle;
|
||||
import com.dfsek.terra.api.platform.inventory.ItemStack;
|
||||
import com.dfsek.terra.api.platform.inventory.Item;
|
||||
import com.dfsek.terra.api.platform.inventory.item.Enchantment;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
public class FabricItemHandle implements ItemHandle {
|
||||
|
||||
@Override
|
||||
public ItemStack newItemStack(MaterialData material, int amount) {
|
||||
public Item createItem(String data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.fabric.inventory;
|
||||
|
||||
import com.dfsek.terra.api.platform.block.MaterialData;
|
||||
import com.dfsek.terra.api.platform.inventory.Item;
|
||||
import com.dfsek.terra.api.platform.inventory.ItemStack;
|
||||
import com.dfsek.terra.api.platform.inventory.item.ItemMeta;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class FabricItemStack implements ItemStack {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialData getType() {
|
||||
public Item getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.dfsek.terra.fabric.world;
|
||||
|
||||
import com.dfsek.terra.api.math.vector.Location;
|
||||
import com.dfsek.terra.api.platform.block.MaterialData;
|
||||
import com.dfsek.terra.api.util.collections.MaterialSet;
|
||||
import com.dfsek.terra.api.world.tree.Tree;
|
||||
import com.dfsek.terra.fabric.TerraFabricPlugin;
|
||||
@@ -13,7 +12,6 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public class FabricTree implements Tree {
|
||||
private final ConfiguredFeature<?, ?> delegate;
|
||||
@@ -30,8 +28,8 @@ public class FabricTree implements Tree {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<MaterialData> getSpawnable() {
|
||||
return MaterialSet.get(TerraFabricPlugin.getInstance().getWorldHandle().createMaterialData("minecraft:grass_block"),
|
||||
TerraFabricPlugin.getInstance().getWorldHandle().createMaterialData("minecraft:podzol"));
|
||||
public MaterialSet getSpawnable() {
|
||||
return MaterialSet.get(TerraFabricPlugin.getInstance().getWorldHandle().createBlockData("minecraft:grass_block"),
|
||||
TerraFabricPlugin.getInstance().getWorldHandle().createBlockData("minecraft:podzol"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,9 @@ package com.dfsek.terra.fabric.world;
|
||||
|
||||
import com.dfsek.terra.api.platform.block.Block;
|
||||
import com.dfsek.terra.api.platform.block.BlockData;
|
||||
import com.dfsek.terra.api.platform.block.MaterialData;
|
||||
import com.dfsek.terra.api.platform.entity.EntityType;
|
||||
import com.dfsek.terra.api.platform.handle.WorldHandle;
|
||||
import com.dfsek.terra.fabric.world.block.FabricBlockData;
|
||||
import com.dfsek.terra.fabric.world.block.FabricMaterialData;
|
||||
import com.dfsek.terra.fabric.world.block.data.FabricMultipleFacing;
|
||||
import com.dfsek.terra.fabric.world.block.data.FabricOrientable;
|
||||
import com.dfsek.terra.fabric.world.block.data.FabricSlab;
|
||||
@@ -31,11 +29,6 @@ public class FabricWorldHandle implements WorldHandle {
|
||||
return block.getBlockData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialData getType(Block block) {
|
||||
return block.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FabricBlockData createBlockData(String data) {
|
||||
BlockArgumentParser parser = new BlockArgumentParser(new StringReader(data), true);
|
||||
@@ -58,11 +51,6 @@ public class FabricWorldHandle implements WorldHandle {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialData createMaterialData(String data) {
|
||||
return new FabricMaterialData(createBlockData(data).getHandle().getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getEntity(String id) {
|
||||
return null;
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.dfsek.terra.api.math.vector.Location;
|
||||
import com.dfsek.terra.api.platform.block.Block;
|
||||
import com.dfsek.terra.api.platform.block.BlockData;
|
||||
import com.dfsek.terra.api.platform.block.BlockFace;
|
||||
import com.dfsek.terra.api.platform.block.MaterialData;
|
||||
import com.dfsek.terra.api.platform.block.BlockType;
|
||||
import com.dfsek.terra.api.platform.block.state.BlockState;
|
||||
import com.dfsek.terra.fabric.world.FabricAdapters;
|
||||
import com.dfsek.terra.fabric.world.handles.world.FabricWorldAccess;
|
||||
@@ -46,7 +46,7 @@ public class FabricBlock implements Block {
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return getBlockData().getMaterial().isAir();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,8 +55,8 @@ public class FabricBlock implements Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialData getType() {
|
||||
return getBlockData().getMaterial();
|
||||
public BlockType getType() {
|
||||
return getBlockData().getBlockType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-5
@@ -1,7 +1,7 @@
|
||||
package com.dfsek.terra.fabric.world.block;
|
||||
|
||||
import com.dfsek.terra.api.platform.block.BlockData;
|
||||
import com.dfsek.terra.api.platform.block.MaterialData;
|
||||
import com.dfsek.terra.api.platform.block.BlockType;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
||||
public class FabricBlockData implements BlockData {
|
||||
@@ -12,13 +12,13 @@ public class FabricBlockData implements BlockData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialData getMaterial() {
|
||||
return new FabricMaterialData(delegate.getBlock());
|
||||
public BlockType getBlockType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(MaterialData materialData) {
|
||||
return ((FabricMaterialData) materialData).getHandle().is(delegate.getBlock());
|
||||
public boolean matches(BlockData other) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,6 +35,11 @@ public class FabricBlockData implements BlockData {
|
||||
return delegate.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getHandle() {
|
||||
return delegate;
|
||||
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
package com.dfsek.terra.fabric.world.block;
|
||||
|
||||
import com.dfsek.terra.api.platform.block.BlockData;
|
||||
import com.dfsek.terra.api.platform.block.MaterialData;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
||||
public class FabricMaterialData implements MaterialData {
|
||||
private final Block delegate;
|
||||
|
||||
public FabricMaterialData(Block delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(MaterialData other) {
|
||||
return delegate.equals(((FabricMaterialData) other).getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(BlockData other) {
|
||||
return delegate.equals(((FabricMaterialData) other.getMaterial()).getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid() {
|
||||
return !delegate.is(Blocks.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir() {
|
||||
return delegate.is(Blocks.AIR); // TODO: better impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxDurability() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData createBlockData() {
|
||||
return new FabricBlockData(delegate.getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getHandle() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return delegate.asItem().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj instanceof FabricMaterialData) {
|
||||
return ((FabricMaterialData) obj).matches(this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user